Skip to content

[fix] Simplify save_to_hub, remove git dependency, add 'token' argument#2376

Merged
tomaarsen merged 6 commits intohuggingface:masterfrom
tomaarsen:fix/upload
Dec 13, 2023
Merged

[fix] Simplify save_to_hub, remove git dependency, add 'token' argument#2376
tomaarsen merged 6 commits intohuggingface:masterfrom
tomaarsen:fix/upload

Conversation

@tomaarsen
Copy link
Member

@tomaarsen tomaarsen commented Dec 13, 2023

Fixes #1777, Fixes #1760, Fixes #1925

Hello!

Pull Request overview

  • Simplify save_to_hub:
  • Add optional token argument. Doesn't need to be provided if huggingface-cli login has been done.
  • Add mocked tests, no actual model upload
  • (Softly) deprecates the "organization" argument.
  • NOTE: save_to_hub now returns the URL to the uploaded model files, not the commit!
  • Update dependencies:
    • transformers>=4.32.0, required for token as used in main
    • huggingface_hub>=0.15.1 as required by transformers>=4.32.0

Details

The huggingface_hub has updated its recommended workflow on how to upload files, and this PR follows the updated version.

NOTE: save_to_hub now returns the URL to the uploaded model files, not the commit! I theorize that this is not a big issue, as I don't suspect many people to use the returned URL.
E.g.

'https://huggingface.co/sentence-transformers-testing/stsb-bert-tiny-copy/tree/main/'
# instead of
'https://huggingface.co/sentence-transformers-testing/stsb-bert-tiny-copy/commit/33dd09cf19b688db045f3850f003497d957b632b'
  • Tom Aarsen

black with line length of 120
100% (but mocked) coverage on save_to_hub
transformers>4.32.0 is required for 'token'
huggingface_hub>=0.15.1 is required by transformers
@tomaarsen tomaarsen merged commit 1565ef6 into huggingface:master Dec 13, 2023
@tomaarsen tomaarsen deleted the fix/upload branch December 13, 2023 16: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

2 participants