Skip to content

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

Closed

Description

@planetf1

m alora upload and m alora add-readme fail straight away on a normal install, with an error that points you at the wrong thing.

With uv sync --all-extras (which gives you huggingface_hub 1.16.1) and no token set:

$ m alora upload ...
ImportError: The 'm alora upload' command requires extra dependencies. Please install them with: pip install "mellea[hf]"

add-readme does the same ("The 'm alora' command requires extra dependencies"). The hf extra is installed, so following the advice does nothing, and the code's own "Hugging Face token not found. Run huggingface-cli login first." message is never reached. That means the aLoRA walkthrough in docs/examples/aLora/README.md can't get past the upload step.

Cause

cli/alora/upload.py:15, cli/alora/commands.py:211 and cli/alora/intrinsic_uploader.py:20 import HfFolder from huggingface_hub inside a try/except ImportError. HfFolder was removed in huggingface_hub 1.0, so the import fails and the handler reports a missing extra. pyproject.toml allows huggingface-hub>=0.33.4, so 1.x is in range, and the lockfile resolves to 1.16.1.

I checked the attribute directly:

huggingface_hub HfFolder get_token
0.33.4 yes yes
0.36.0 yes yes
1.0.0 no yes
1.16.1 no yes

Suggested fix

Use huggingface_hub.get_token() instead of HfFolder.get_token() at the three call sites. It exists across the whole supported range. It would also be worth a test that imports these CLI modules against the locked huggingface_hub, so a removal like this fails in CI and not at the user's terminal.

Found while reviewing #1765.

Activity

  1. added
    bug
    p1
    area/alora
    area/cli
    on Nov 5, 2026
  2. skritosss commented on Nov 6, 2026

    @skritosss
    Contributor

    I would like to work on this compatibility fix. The current upload modules still import HfFolder. My planned scope is to switch the three token lookups to get_token() and add offline regressions for imports and authentication behavior, without uploading any weights or requiring real credentials. Could a maintainer assign this issue and confirm that this scope is welcome? I will disclose AI assistance in the contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/aloraarea/clibugp1

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions