[Solved] ValueError: Connection error, and we cannot find the requested files in the cached path…

error:

self.tokenizer = CamembertTokenizer.from_pretrained(“camembert-base”)
resolved_vocab_files[file_id] = cached_path(
output_path = get_from_cache(
raise ValueError(
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.

Solution.
When running the command line type

TRANSFORMERS_OFFLINE=1  python test.py
sh file is:
TRANSFORMERS_OFFLINE=1  \ python test.py

When running the code
Refer to the official website at
Reason for error reporting.

Firewalled environments
Some cloud and intranet setups have their GPU instances firewalled to the outside world, so if your script is trying to download model weights or datasets it will first hang and then timeout with an error message like:
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.
One possible solution in this situation is to use the “offline-mode”.

Solution: Offline mode

It’s possible to run 🤗 Transformers in a firewalled or a no-network environment.
Setting environment variable TRANSFORMERS_OFFLINE=1 will tell 🤗 Transformers to use local files only and will not try to look things up.
Most likely you may want to couple this with HF_DATASETS_OFFLINE=1 that performs the same for 🤗 Datasets if you’re using the latter.

Read More: