Skip to content

Add cli for @huggingface/hub #1412

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open

Add cli for @huggingface/hub #1412

wants to merge 20 commits into from

Conversation

coyotte508
Copy link
Member

@coyotte508 coyotte508 commented Apr 30, 2025

cc @Wauplin @hanouticelina for viz

Internal context: https://huggingface.slack.com/archives/C0256NXF0A2/p1745930278721439?thread_ts=1741697907.530409&cid=C0256NXF0A2

Also add createBranch and deleteBranch functions

Follow up to #1398

eg:

npm install -g @huggingface/hub 
export HF_TOKEN=...

# Upload current dir to coyotte508/test-model in a new empty "build" branch
hfjs upload coyotte508/test-model --revision build --from-empty

Testing

go into packages/hub

run pnpm install

and run sudo npm link - then you can use hfjs

or just do node dist/cli.js upload ...

@coyotte508 coyotte508 mentioned this pull request May 6, 2025
Co-authored-by: Julien Chaumond <[email protected]>
coyotte508 added a commit that referenced this pull request May 6, 2025
That way I can run `pnpm link`: https://pnpm.io/cli/link to test
#1412
@HuggingFaceDocBuilderDev

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.

@coyotte508
Copy link
Member Author

coyotte508 commented May 6, 2025

btw @Wauplin @hanouticelina do you have advice regarding the cli params?

This PR adds --from-revision and --from-empty that to the best of my knowledge are not present in the python cli

  • --from-empty => hfjs upload --revision new --from-empty will create an empty branch before committing to it
  • --from-revision => hfjs upload --revision new --from-revision xxx will create a branch with the last commit from xxx before committing to it

Note that we could be fancy and do like git --revision :new to create from empty, and --revision xxx:new to create new from xxx

Edit: is the hub url configurable or not with the python cli? (thinking of adding --hub-url cli param but it can be hidden)

@coyotte508 coyotte508 marked this pull request as ready for review May 6, 2025 15:31
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