Skip to content

Checking for additional_chat_templates doesn't work without internet (ConnectionError) #39873

@akug

Description

@akug

System Info

  • transformers version: 4.55.0.dev0
  • Platform: Linux-6.6.87.2-microsoft-standard-WSL2-x86_64-with-glibc2.35
  • Python version: 3.10.12
  • Huggingface_hub version: 0.34.3
  • Safetensors version: 0.5.3
  • Accelerate version: 1.9.0
  • Accelerate config: not found
  • DeepSpeed version: not installed
  • PyTorch version (accelerator?): 2.7.1+cu126 (NA)
  • Tensorflow version (GPU?): not installed (NA)
  • Flax version (CPU?/GPU?/TPU?): not installed (NA)
  • Jax version: not installed
  • JaxLib version: not installed
  • Using distributed or parallel set-up in script?:

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

This bug only occurs in the following scenario:

  1. The user uses a model that uses a tokenizer that can have additional_chat_templates
  2. The user runs the code without internet connection
  3. The user did NOT set HF_HUB_OFFLINE=1, so offline mode is not enabled.

One example is running the train_dreambooth_lora_sdxl.py script without any adaptations, like this:

  1. Download the SDXL model files and the vae model files into the cache
  2. Turn off internet
  3. Check that HF_HUB_OFFLINE is unset
  4. Run the script

The error signature:

requests.exceptions.ConnectionError: (MaxRetryError('HTTPSConnectionPool(...): Max retries exceeded with url: /api/models/stabilityai/stable-diffusion-xl-base-1.0/tree/main/additional_chat_templates?recursive=False&expand=False (Caused by ...)))

Expected behavior

The script works without issues, because all files exist in the cache.

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