You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be great to have a CLI command to upload files, using HTTP-only methods. This is not a plan to write a wrapper around git CLI but rather around upload_file and upload_folder utilities.
# Upload `config.json` to a PR in a dataset
>>> huggingface-cli upload Wauplin/my-cool-dataset config.json --repo-type=dataset --revision=refs/pr/1
Create a PR
# Update `config.json` to a PR
>>> huggingface-cli upload Wauplin/my-cool-dataset config.json --repo-type=dataset --create-pr
All of the above cases can be dealt with upload_file and upload_folder. CLI must determine which one to use based on if PATH is a file or a folder.
Potential issues to gracefully handle:
repo_id does not exist: if so, there is an existing huggingface-cli repo create to suggest
--token is not passed and huggingface-cli login has not being run
PATH does not exists
--allow-patterns / --ignore-patterns is used with a file path (doesn't make sense)
CLI command can be implemented in several PRs, with some features added later. Implementation and tests must solely be based on upload_file and upload_folder (logic must not be re-implemented)
The text was updated successfully, but these errors were encountered:
Related to #1105 (cli to download files) and especially #1105 (comment).
It would be great to have a CLI command to upload files, using HTTP-only methods. This is not a plan to write a wrapper around git CLI but rather around
upload_file
andupload_folder
utilities.Usage
Upload file
Explicit path in repo
# Upload `path/to/file.json` as `data.json` on the Hub >>> huggingface-cli upload Wauplin/my-cool-model path/to/file.json data.json
Implicit path_in_repo computed based on relative path to current pwd
# Upload `path/to/file.json` as `path/to/file.json` on the Hub >>> huggingface-cli upload Wauplin/my-cool-model path/to/file.json
Upload folder
Explicit path_in_repo
# Upload `path/to/folder` to `data/` on the Hub >>> huggingface-cli upload Wauplin/my-cool-model path/to/folder data/
Implicit path_in_repo based on relative path to current pwd.
Implicit path_in_repo must be computed as POSIX path (even on Windows)
# Upload `path/to/folder` to `path/to/folder/` on the Hub >>> huggingface-cli upload Wauplin/my-cool-model path/to/folder
Implicit folder
Upload folder with filters
And also
--ignore-patterns
.Specify
repo_type
andrevision
# Upload `config.json` to a PR in a dataset >>> huggingface-cli upload Wauplin/my-cool-dataset config.json --repo-type=dataset --revision=refs/pr/1
Create a PR
# Update `config.json` to a PR >>> huggingface-cli upload Wauplin/my-cool-dataset config.json --repo-type=dataset --create-pr
All of the above cases can be dealt with
upload_file
andupload_folder
. CLI must determine which one to use based on ifPATH
is a file or a folder.Potential issues to gracefully handle:
huggingface-cli repo create
to suggest--token
is not passed andhuggingface-cli login
has not being runPATH
does not exists--allow-patterns
/--ignore-patterns
is used with a file path (doesn't make sense)CLI command can be implemented in several PRs, with some features added later. Implementation and tests must solely be based on
upload_file
andupload_folder
(logic must not be re-implemented)The text was updated successfully, but these errors were encountered: