Repository navigation
Conversation
Replace removed HfFolder calls with get_token and preserve authentication errors during intrinsic-upload cleanup. Add offline import and authentication regressions for all three upload paths. Assisted-by: Codex Signed-off-by: Alex Shuvalov <shuv.aleksandr@icloud.com>
| token = get_token() | ||
| if token is None: | ||
| raise OSError( | ||
| "Hugging Face token not found. Run `huggingface-cli login` first." |
There was a problem hiding this comment.
Thanks for picking this up, the fix looks spot on.
One small thing I spotted while trying it out. Now that people can actually reach this error on newer versions of huggingface_hub, it tells them to run huggingface-cli login, and that command has been retired. Running it just prints a note saying to use hf instead, which isn't much help to someone who's already stuck.
We still support older versions that don't have hf, so it's probably best to mention both. Something like "set HF_TOKEN or run hf auth login" would cover everyone. The same message also appears in intrinsic_uploader.py and commands.py.
Feel free to change those three here if you're happy to. If not, no worries, I'll raise a separate issue, since a few docs have the same wording and need tidying anyway.
There was a problem hiding this comment.
Updated in 6c579a7. All three missing-token errors now recommend setting HF_TOKEN or running hf auth login; the three missing-token regressions assert the exact guidance.
Offline checks: 496 CLI tests passed, two optional training modules skipped. All seven upload regressions also pass with Hub 0.33.4, in addition to the locked 1.16.1. Ruff and focused mypy pass. The full local mypy gate is not green in this partial optional-dependency environment: it reports the same 148 errors in 50 files on both this update and the unmodified previous PR head, with no new errors.
This follow-up was assisted by Codex. No real tokens, uploads or model calls were used in these tests.
Recommend HF_TOKEN or hf auth login in all three missing-token errors and assert the exact guidance in offline upload regressions. Assisted-by: Codex Signed-off-by: Alex Shuvalov <shuv.aleksandr@icloud.com>
Pull Request
Thanks for sending a pull request! Please make sure you read the contributing guidelines.
Issue
Fixes #1791
Description
The aLoRA upload commands now use
huggingface_hub.get_token(), available throughout the supported Hub range, instead of the removedHfFolder. Both upload modules import successfully with Hub 1.x, andadd-readmereaches its intended authentication flow rather than reporting a missing extra that is already installed.The intrinsic uploader also guards cleanup until its staging directory has been created. Otherwise a missing token raises the intended
OSErrorbut thefinallyblock replaces it with anUnboundLocalError, hiding the authentication error once the import is fixed.Seven offline regressions exercise module imports and authenticated/missing-token paths for plain uploads, intrinsic uploads, and README upload orchestration. Hub writes are mocked; README generation is isolated from the LLM. No real credentials, model downloads, or uploads are required. Existing staging and upload payload behavior is retained.
Testing
Local checks on Python 3.12, based on
mainatcf484f7:uv run --no-sync pytest test/cli -m 'not e2e and not qualitative' --no-cov -q: 496 passed, 2 skipped. This is the selected CLI suite, not a full all-extras/backend/e2e run.huggingface-hub==0.33.4and the lockedhuggingface-hub==1.16.1. Before the fix, all seven fail against Hub 1.16.1 on the removed import.--follow-imports=skip.--no-install-types --interactive -O json --no-incremental --no-error-summary .against both this branch and an unmodified archive of the currentmain, using the same environment. Both report the same 148 errors across 50 files, with no added or removed errors. This does not claim a passing full pre-commit gate or the complete optional-dependency CI environment.Attribution
Assisted by OpenAI Codex. Changes and verification were reviewed before submission.
Adding a new component, requirement, sampling strategy, or tool?
If your PR adds or modifies one of the types below, check the matching box. A checklist of type-specific review items will be posted as a comment.
This is a CLI compatibility fix; none of these types changes.