fix(tests): restore ModelOnTheFlyConversionTester after token revocation and Space API migration (#50075)
* fix(tests): update ModelOnTheFlyConversionTester to use hf-transformers-bot token and hf-internal-testing org
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix thread name mismatch in test_absence_of_safetensors_triggers_conversion
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix safetensors Space API URL and increase thread join timeout
- Update spawn_conversion() to use /gradio_api/call/run (Gradio v5 migration
changed the endpoint from /call/run)
- Increase thread join timeout from 10s to 60s to give the Space enough time
to respond (typically needs 20-30s)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(tests): unset DISABLE_SAFETENSORS_CONVERSION in ModelOnTheFlyConversionTester
conftest.py globally sets DISABLE_SAFETENSORS_CONVERSION=true to avoid Hub
traffic during regular test runs (PR #41194). ModelOnTheFlyConversionTester
specifically exercises the conversion path, so it needs to unset the var in
setUp and restore it in tearDown.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(config): forward token kwarg to get_config_dict in PreTrainedConfig.from_pretrained
token was an explicit parameter of from_pretrained but was never added to kwargs
before calling get_config_dict, causing it to arrive as None in cached_files.
This broke loading from private repos when token= was passed as a kwarg (it only
worked if HF_TOKEN env var was set).
Also update ModelOnTheFlyConversionTester:
- re-enable private conversion tests (now work with the token fix)
- fix assertion: private PR author is "hf-transformers-bot", not self.user
- skip gated tests with a note: SFconvertbot cannot agree to gating on
dynamically-created repos (needs further investigation, may have worked
previously with huggingface-hub-ci org setup)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* skip private/gated conversion tests; revert author assertions
Private repo conversion tests are skipped — no strong need to test this
path since SFconvertbot opens PRs for public repos, and private repo
behaviour is covered by the Space separately.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* re-enable private conversion tests (they pass with token fix)
Private repo conversion works since configuration_utils.py now correctly
forwards `token` to `get_config_dict`. PR author for private repos is
`hf-transformers-bot` (the token owner). Only gated tests remain skipped
(Space-side limitation).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* use TRANSFORMERS_HUB_BOT_HF_TOKEN (with HF_TOKEN fallback) in conversion tester
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* rename cls.user → cls.org (hf-internal-testing is an org, not a user)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* clarify token requirement and skip message in ModelOnTheFlyConversionTester
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* use hf-ci-ephemeral-repos org and HF_CI_EPHEMERAL_REPO_MANIPULATION_TOKEN
Switch to a dedicated org and fine-grained token scoped only to
ephemeral repo create/delete + discussions, instead of the broader
TRANSFORMERS_HUB_BOT_HF_TOKEN.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* add inline comment explaining thread.join(timeout=60)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>