Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Transformers pipeline model directory

I'm using the Huggingface's Transformers pipeline function to download the model and the tokenizer, my Windows PC downloaded them but I don't know where they are stored on my PC. Can you please help me? enter image description here

from transformers import pipeline

qa_pipeline = pipeline(
    "question-answering",
    model="mrm8488/bert-multi-cased-finetuned-xquadv1",
    tokenizer="mrm8488/bert-multi-cased-finetuned-xquadv1"
)
like image 877
Luan Tran Avatar asked Feb 03 '26 01:02

Luan Tran


2 Answers

You can check the default location with:

import transformers #it is important to load the library before checking!
import os
os.environ['TRANSFORMERS_CACHE']

In case you want to change the default location, please have a lock at this answer.

like image 88
cronoik Avatar answered Feb 04 '26 13:02

cronoik


The default folder for models is at ~/.cache/huggingface And here's the doc from huggingface https://huggingface.co/docs/transformers/installation#cache-setup

like image 21
杨晨豪 Avatar answered Feb 04 '26 13:02

杨晨豪