Skip to content

Conversation

@Wauplin
Copy link
Contributor

@Wauplin Wauplin commented Jan 6, 2026

Disclaimer: partially AI-generated
- PR description: Claude Code
- _cli_utils.py: Claude Code
- install.sh: mainly me
- install.ps1: mainly Claude Code


Summary

This PR adds support for installing the transformers CLI alongside the huggingface_hub CLI in the standalone installer scripts, and refactors the CLI update checker to support multiple libraries.

Changes

CLI Update Checker (_cli_utils.py, hf.py):

  • check_cli_update() now accepts a required library parameter (Literal["huggingface_hub", "transformers"]) to check updates for different libraries
  • Extracted _get_huggingface_hub_update_command() and _get_transformers_update_command() helper functions for cleaner code organization
  • Updated hf.py to pass "huggingface_hub" to check_cli_update()

Installer Scripts (install.sh, install.ps1):

  • Added --with-transformers flag (bash) / -WithTransformers parameter (PowerShell) to optionally install the transformers CLI
  • If transformers is already installed in the venv, it automatically gets upgraded (even without the flag) to keep it in sync
  • Uses importlib.metadata for fast package detection (avoids slow module import)
  • Refactored common installation logic into shared install_package() / Install-Package functions
  • Removed HF_CLI_VERSION environment variable support (always installs latest version)

Usage

# Install hf CLI only (default)
curl -LsSf https://hf.co/cli/install.sh | bash -s

# Install both hf and transformers CLIs
curl -LsSf https://hf.co/cli/install.sh | bash -s -- --with-transformers
# Install hf CLI only (default)
powershell -c "irm https://hf.co/cli/install.ps1 | iex"

# Install both hf and transformers CLIs
powershell -c "irm https://hf.co/cli/install.ps1 | iex" -WithTransformers

TODO

Once this PR is merged, let's release it and integrate check_cli_update into transformers CLI for auto-update detection.

@Wauplin Wauplin requested a review from hanouticelina January 6, 2026 15:38
@Wauplin Wauplin mentioned this pull request Jan 6, 2026
7 tasks
@bot-ci-comment
Copy link

bot-ci-comment bot commented Jan 6, 2026

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Copy link
Contributor

@hanouticelina hanouticelina left a comment

Choose a reason for hiding this comment

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

looks good to me! thanks
approving the PR but i'm still not convinced about having a one liner installer for transformers here (since we try to be library agnostic as much as possible) but no strong opinion either (cc @LysandreJik if you have an opinion on that).

@Wauplin
Copy link
Contributor Author

Wauplin commented Jan 7, 2026

As discussed offline, we try to be library agnostic in huggingface_hub in general but for CLIs specifically I think it's fine to be a bit more opinionated.

So I'll merge this one and follow-up with transformers integration.


Btw haven't mentioned in the PR description but the end goal is to be able to do

curl -LsSf https://hf.co/cli/install.sh | bash -s -- --with-transformers
transformers serve
transformers chat openai/gpt-oss-120b

@Wauplin Wauplin merged commit 30266c5 into main Jan 7, 2026
23 of 25 checks passed
@Wauplin Wauplin deleted the transformers-cli-installer branch January 7, 2026 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants