Skip to content

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

Open

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
    bugSomething isn't working
    p1High: important bugs (workaround exists) or high-value core features. Do soon, not on fire.
    area/aloraLoRA/aLora adapter training
    area/clim serve, m alora, CLI commands
    on Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/aloraLoRA/aLora adapter trainingarea/clim serve, m alora, CLI commandsbugSomething isn't workingp1High: important bugs (workaround exists) or high-value core features. Do soon, not on fire.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions