Skip to content

API requests are made despite setting local_files_only=True.Β #43502

@haok1402

Description

@haok1402

System Info

API requests are made despite setting local_files_only=True when loading a pretrained tokenizers.

Here is the relevant part of the code that triggers the requests.

def is_base_mistral(model_id: str) -> bool:
model = model_info(model_id)
if model.tags is not None:
if re.search("base_model:.*mistralai", "".join(model.tags)):
return True
return False
if is_offline_mode():
is_local = True
if pretrained_model_name_or_path is not None and (
is_local or (not is_local and is_base_mistral(pretrained_model_name_or_path))
):

model_info inside is_base_mistral triggers this.

Who can help?

No response

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

from transformers import AutoTokenizer

AutoTokenizer.from_pretrained("Qwen/Qwen3-30B-A3B", local_files_only=True)

Expected behavior

There should be no network requests being made with local_files_only=True.

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