-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Add docs about the CLI #6831
Merged
Merged
Add docs about the CLI #6831
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9934b5e
Add docs about the CLI
albertvillanova e6b4bbd
Add links to the docs
albertvillanova 49bce73
Add example
albertvillanova e4dc7c7
Update CLI convert_to_parquet help message
albertvillanova a90385f
Fix style
albertvillanova 5282ec4
Replace leading $ with >>> in code snippets
albertvillanova ef81f77
Replace shell with bash in code snippets to fix coloring
albertvillanova File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Command Line Interface (CLI) | ||
|
||
🤗 Datasets provides a command line interface (CLI) with useful shell commands to interact with your dataset. | ||
|
||
You can check the available commands: | ||
```bash | ||
>>> datasets-cli --help | ||
usage: datasets-cli <command> [<args>] | ||
|
||
positional arguments: | ||
{convert,env,test,run_beam,dummy_data,convert_to_parquet} | ||
datasets-cli command helpers | ||
convert Convert a TensorFlow Datasets dataset to a HuggingFace Datasets dataset. | ||
env Print relevant system environment info. | ||
test Test dataset implementation. | ||
run_beam Run a Beam dataset processing pipeline | ||
dummy_data Generate dummy data. | ||
convert_to_parquet Convert dataset to Parquet | ||
|
||
optional arguments: | ||
-h, --help show this help message and exit | ||
``` | ||
|
||
## Convert to Parquet | ||
|
||
Easily convert your Hub [script-based dataset](dataset_script) to Parquet [data-only dataset](repository_structure), so that the dataset viewer will be supported. | ||
|
||
```bash | ||
>>> datasets-cli convert_to_parquet --help | ||
usage: datasets-cli <command> [<args>] convert_to_parquet [-h] [--token TOKEN] [--revision REVISION] [--trust_remote_code] dataset_id | ||
|
||
positional arguments: | ||
dataset_id source dataset ID, e.g. USERNAME/DATASET_NAME or ORGANIZATION/DATASET_NAME | ||
|
||
optional arguments: | ||
-h, --help show this help message and exit | ||
--token TOKEN access token to the Hugging Face Hub | ||
--revision REVISION source revision | ||
--trust_remote_code whether to trust the code execution of the load script | ||
``` | ||
|
||
This command: | ||
- makes a copy of the script on the "main" branch into a dedicated branch called "script" (if it does not already exists) | ||
- creates a pull request to the Hub dataset to convert it to Parquet files (and deletes the script from the main branch) | ||
|
||
If in the future you need to recreate the Parquet files from the "script" branch, pass the `--revision script` argument. | ||
|
||
Note that you should pass the `--trust_remote_code` argument only if you trust the remote code to be executed locally on your machine. | ||
|
||
For example: | ||
```bash | ||
>>> datasets-cli convert_to_parquet USERNAME/DATASET_NAME --token USER_ACCESS_TOKEN | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would not advertise the
--token
arg in the example as this shouldn't be the recommended way (best to login with env variable orhuggingface-cli login
)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your comment @Wauplin. I am fixing that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed by: