I need to run my project in offline mode, I have set the environment variable, tokenizer, and model are both being called locally and I set local_files_only = True.
My code runs, but my question is how do I know if it’s actually running locally, and not trying call API to Hugging Face?
The following is my code.
from transformers import AutoTokenizer, AutoModelForQuestionAnswering, pipeline
os.environ[“TRANSFORMERS_OFFLINE”] = “1”
dir = r"mypath"
tokenizer = AutoTokenizer.from_pretrained(dir, local_files_only = True)
model = AutoModelForQuestionAnswering.from_pretrained(dir, local_files_only = True)
question_answerer = pipeline(“question-answering”, model=model, tokenizer=tokenizer)