Skip to content

Conversation

@Wauplin
Copy link
Contributor

@Wauplin Wauplin commented Nov 25, 2025

This PR removes the possibility to load a Config using a file URL directly. This is a deprecated feature expected to be removed in transformers v5:

    warnings.warn(
        f"Using `from_pretrained` with the url of a file (here {url}) is deprecated and won't be possible anymore in"
        " v5 of Transformers. You should host your file on the Hub (hf.co) instead and use the repository ID. Note"
        " that this is not compatible with the caching system (your file will be downloaded at each execution) or"
        " multiple processes (each process will download the file in a different temporary file).",
        FutureWarning,
    )

I've also removed the legacy test test_legacy_load_from_one_file testing this feature.


In addition, this allowed me to cleanup the is_remote_url and download_url helpers and to entirely avoid importing http_get from huggingface_hub (which is to be considered a "semi-private" helper. I have refactored a few tests using it to default to hf_hub_download instead.

@Wauplin Wauplin requested a review from a team November 25, 2025 09:24
@github-actions
Copy link
Contributor

[For maintainers] Suggested jobs to run (before merge)

run-slow: metaclip_2

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@Wauplin Wauplin marked this pull request as ready for review November 25, 2025 09:53
@Wauplin Wauplin enabled auto-merge (squash) November 25, 2025 09:53
@Wauplin
Copy link
Contributor Author

Wauplin commented Nov 25, 2025

This PR is ready for review. CI is failing on

FAILED tests/models/kosmos2/test_modeling_kosmos2.py::Kosmos2ModelTest::test_assisted_decoding_matches_greedy_search_1_same - AssertionError: False is not true

which looks unrelated to the PR. I already retriggered the CI once but it didn't help.

Copy link
Member

@LysandreJik LysandreJik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really satisfying PR, thanks for handling this @Wauplin!

@LysandreJik LysandreJik disabled auto-merge November 27, 2025 13:57
@LysandreJik LysandreJik merged commit e1ab709 into main Nov 27, 2025
23 of 25 checks passed
@LysandreJik LysandreJik deleted the remove-deprecated-download-from-file branch November 27, 2025 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants