Skip to content

fix(cli): use supported Hub token lookup for aLoRA uploads - #1798

Merged
planetf1 merged 2 commits into
generative-computing:mainfrom
skritosss:fix/1791-hub-token-current
Nov 16, 2026
Merged

planetf1 merged 2 commits into
generative-computing:mainfrom
skritosss:fix/1791-hub-token-current

Conversation

@skritosss

Copy link
Copy Markdown
Contributor

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 removed HfFolder. Both upload modules import successfully with Hub 1.x, and add-readme reaches 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 OSError but the finally block replaces it with an UnboundLocalError, 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

  • Tests added to the respective file if code was changed
  • New code has 100% coverage if code was added
  • Ensure existing tests and github automation passes (a maintainer will kick off the github automation when the rest of the PR is populated)

Local checks on Python 3.12, based on main at cf484f7:

  • 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.
  • The seven new regressions pass separately with the lower supported huggingface-hub==0.33.4 and the locked huggingface-hub==1.16.1. Before the fix, all seven fail against Hub 1.16.1 on the removed import.
  • Focused coverage reaches all eight changed executable production lines. This is changed-line coverage, not 100% coverage of the entire existing modules.
  • Ruff check and format check pass for all four changed files. Focused mypy passes with --follow-imports=skip.
  • Repository-wide mypy is not green in this partial dependency environment. To check for regressions, I ran the same analyzer with --no-install-types --interactive -O json --no-incremental --no-error-summary . against both this branch and an unmodified archive of the current main, 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

  • AI coding assistants used

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.

  • Component
  • Requirement
  • Sampling Strategy
  • Tool

This is a CLI compatibility fix; none of these types changes.

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 <[email protected]>
@skritosss
skritosss requested a review from a team as a code owner November 8, 2026 18:58
@github-actions github-actions Bot added the bug Something isn't working label Nov 8, 2026
Comment thread cli/alora/upload.py Resolved
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 <[email protected]>

@planetf1 planetf1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks, that's exactly what I was after, and the temp_dir guard is a good catch too. I ran the new tests against huggingface-hub 0.33.4 and 1.16.1, and they all fail with the fix reverted.

As mentioned, I've raised the remaining huggingface-cli login wording in the docs and adapter errors as #1813. While reading upload_intrinsic I also found it modifies the local adapter directory, deleting README.md and leaving io.yaml behind. That bug is older than this PR and is now #1812.

@planetf1
planetf1 added this pull request to the merge queue Nov 16, 2026
Merged via the queue into generative-computing:main with commit 807b540 Nov 16, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(cli): m alora upload and add-readme fail with an ImportError on huggingface_hub 1.x (HfFolder removed)

2 participants