Load model from cache or disk not working
Library versions in my conda environment:pytorch == 1.10.2tokenizers == 0.10.1transformers == 4.6.1 (cannot really upgrade due to a GLIB lib issue on linux)I am trying to load a model and tokenizer  - ProsusAI/finbert (already cached on disk by an earlier run in ~/.cache/huggingface/transformers/) using the transformers/tokenizers library, on a machine with no internet access.However, when I try to load up the model using the below command, it throws up a connection error:model = AutoModelForSequenceClassification.from_pretrained("ProsusAI/finbert", local_files_only=True)
tokenizer = AutoTokenizer.from_pretrained("ProsusAI/finbert", local_files_only=True)However I still get the error: ValueError: Connection error, and we cannot find the requested files in the cached path. Please try again or make sure your Internet connection is on.So, then, I download all model files fromhereand tried loading the model from that directory using the below command:model = AutoModelForSequenceClassification.from_pretrained("./PATH_TO_FILES/", local_files_only=True)
tokenizer = AutoTokenizer.from_pretrained("./PATH_TO_FILES/", local_files_only=True)This throws the same error I got above. This error persists on setting the environment variable to offline mode byos.environ["TRANSFORMERS_OFFLINE"] = "1"Is there a way to really load models from cache if I don’t have access to internet on the machine?Thanks!
2022-10-16T11:56:53Z
@s0ap, have you managed to solve your problem?