Skip to content

Tokenizer fails to load from cache when HF_HUB_OFFLINE=1 on 4.57.3 #42886

@chtruong814

Description

@chtruong814

System Info

transformers==4.57.3

Who can help?

@vasqu @ArthurZucker

Information

  • The official example scripts
  • My own modified scripts

Tasks

  • An officially supported task in the examples folder (such as GLUE/SQuAD, ...)
  • My own task or dataset (give details below)

Reproduction

With HF_HUB_OFFLINE=0 and a HF_TOKEN set

AutoTokenizer.from_pretrained('meta-llama/Meta-Llama-3-8B')

Then with HF_HUB_OFFLINE=1 and a HF_TOKEN set

AutoTokenizer.from_pretrained('meta-llama/Meta-Llama-3-8B')

It will raise the following error:

raise OfflineModeIsEnabled(
huggingface_hub.errors.OfflineModeIsEnabled: Cannot reach https://huggingface.co/api/models/meta-llama/Meta-Llama-3-8B: offline mode is enabled. To disable it, please unset the `HF_HUB_OFFLINE` environment variable.

Expected behavior

I would expect the library to check for the cache files first before attempting to download files. However, it does not seem to do this anymore. This worked with 4.57.1.

4.57.2 had other problems that 4.57.3 was intending to address.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions