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
Copy file name to clipboardExpand all lines: docs/source/en/guides/cli.md
+22-22Lines changed: 22 additions & 22 deletions
Original file line number
Diff line number
Diff line change
@@ -603,28 +603,28 @@ Copy-and-paste the text below in your GitHub issue.
603
603
- HF_HUB_DOWNLOAD_TIMEOUT: 10
604
604
```
605
605
606
-
## huggingface-cli jobs
606
+
## hf jobs
607
607
608
608
Run compute jobs on Hugging Face infrastructure with a familiar Docker-like interface.
609
609
610
-
`huggingface-cli jobs` is a command-line tool that lets you run anything on Hugging Face's infrastructure (including GPUs and TPUs!) with simple commands. Think `docker run`, but for running code on A100s.
610
+
`hf jobs` is a command-line tool that lets you run anything on Hugging Face's infrastructure (including GPUs and TPUs!) with simple commands. Think `docker run`, but for running code on A100s.
611
611
612
612
```bash
613
613
# Directly run Python code
614
-
>>> huggingface-clijobs run python:3.12 python -c "print('Hello from the cloud!')"
614
+
>>> hfjobs run python:3.12 python -c "print('Hello from the cloud!')"
615
615
616
616
# Use GPUs without any setup
617
-
>>> huggingface-clijobs run --flavor a10g-small pytorch/pytorch:2.6.0-cuda12.4-cudnn9-devel \
617
+
>>> hfjobs run --flavor a10g-small pytorch/pytorch:2.6.0-cuda12.4-cudnn9-devel \
>>> huggingface-clijobs run --namespace my-org-name python:3.12 python -c "print('Running in an org account')"
621
+
>>> hfjobs run --namespace my-org-name python:3.12 python -c "print('Running in an org account')"
622
622
623
623
# Run from Hugging Face Spaces
624
-
>>> huggingface-clijobs run hf.co/spaces/lhoestq/duckdb duckdb -c "select 'hello world'"
624
+
>>> hfjobs run hf.co/spaces/lhoestq/duckdb duckdb -c "select 'hello world'"
625
625
626
626
# Run a Python script with `uv` (experimental)
627
-
>>> huggingface-clijobs uv run my_script.py
627
+
>>> hfjobs uv run my_script.py
628
628
```
629
629
630
630
### ✨ Key Features
@@ -642,7 +642,7 @@ Run compute jobs on Hugging Face infrastructure with a familiar Docker-like inte
642
642
643
643
```bash
644
644
# Run a simple Python script
645
-
>>> huggingface-clijobs run python:3.12 python -c "print('Hello from HF compute!')"
645
+
>>> hfjobs run python:3.12 python -c "print('Hello from HF compute!')"
646
646
```
647
647
648
648
This command runs the job and shows the logs. You can pass `--detach` to run the Job in the background and only print the Job ID.
@@ -651,16 +651,16 @@ This command runs the job and shows the logs. You can pass `--detach` to run the
651
651
652
652
```bash
653
653
# List your running jobs
654
-
>>> huggingface-clijobs ps
654
+
>>> hfjobs ps
655
655
656
656
# Inspect the status of a job
657
-
>>> huggingface-clijobs inspect <job_id>
657
+
>>> hfjobs inspect <job_id>
658
658
659
659
# View logs from a job
660
-
>>> huggingface-clijobs logs <job_id>
660
+
>>> hfjobs logs <job_id>
661
661
662
662
# Cancel a job
663
-
>>> huggingface-clijobs cancel <job_id>
663
+
>>> hfjobs cancel <job_id>
664
664
```
665
665
666
666
#### 3. Run on GPU
@@ -669,7 +669,7 @@ You can also run jobs on GPUs or TPUs with the `--flavor` option. For example, t
669
669
670
670
```bash
671
671
# Use an A10G GPU to check PyTorch CUDA
672
-
>>> huggingface-clijobs run --flavor a10g-small pytorch/pytorch:2.6.0-cuda12.4-cudnn9-devel \
672
+
>>> hfjobs run --flavor a10g-small pytorch/pytorch:2.6.0-cuda12.4-cudnn9-devel \
673
673
... python -c "import torch; print(f"This code ran with the following GPU: {torch.cuda.get_device_name()}")"
674
674
```
675
675
@@ -696,22 +696,22 @@ You can pass environment variables to your job using
696
696
697
697
```bash
698
698
# Pass environment variables
699
-
>>> huggingface-cli jobs run -e FOO=foo -e BAR=bar python:3.12 python -c "import os; print(os.environ['FOO'], os.environ['BAR'])"
699
+
>>> hf jobs run -e FOO=foo -e BAR=bar python:3.12 python -c "import os; print(os.environ['FOO'], os.environ['BAR'])"
700
700
```
701
701
702
702
```bash
703
703
# Pass an environment from a local .env file
704
-
>>> huggingface-cli jobs run --env-file .env python:3.12 python -c "import os; print(os.environ['FOO'], os.environ['BAR'])"
704
+
>>> hf jobs run --env-file .env python:3.12 python -c "import os; print(os.environ['FOO'], os.environ['BAR'])"
705
705
```
706
706
707
707
```bash
708
708
# Pass secrets - they will be encrypted server side
709
-
>>> huggingface-cli jobs run -s MY_SECRET=psswrd python:3.12 python -c "import os; print(os.environ['MY_SECRET'])"
709
+
>>> hf jobs run -s MY_SECRET=psswrd python:3.12 python -c "import os; print(os.environ['MY_SECRET'])"
710
710
```
711
711
712
712
```bash
713
713
# Pass secrets from a local .env.secrets file - they will be encrypted server side
714
-
>>> huggingface-cli jobs run --secrets-file .env.secrets python:3.12 python -c "import os; print(os.environ['MY_SECRET'])"
714
+
>>> hf jobs run --secrets-file .env.secrets python:3.12 python -c "import os; print(os.environ['MY_SECRET'])"
715
715
```
716
716
717
717
### Hardware
@@ -730,19 +730,19 @@ Run UV scripts (Python scripts with inline dependencies) on HF infrastructure:
730
730
731
731
```bash
732
732
# Run a UV script (creates temporary repo)
733
-
>>> huggingface-cli jobs uv run my_script.py
733
+
>>> hf jobs uv run my_script.py
734
734
735
735
# Run with persistent repo
736
-
>>> huggingface-cli jobs uv run my_script.py --repo my-uv-scripts
736
+
>>> hf jobs uv run my_script.py --repo my-uv-scripts
737
737
738
738
# Run with GPU
739
-
>>> huggingface-cli jobs uv run ml_training.py --flavor gpu-t4-small
739
+
>>> hf jobs uv run ml_training.py --flavor gpu-t4-small
740
740
741
741
# Pass arguments to script
742
-
>>> huggingface-cli jobs uv run process.py input.csv output.parquet --repo data-scripts
742
+
>>> hf jobs uv run process.py input.csv output.parquet --repo data-scripts
743
743
744
744
# Run a script directly from a URL
745
-
>>> huggingface-cli jobs uv run https://huggingface.co/datasets/username/scripts/resolve/main/example.py
745
+
>>> hf jobs uv run https://huggingface.co/datasets/username/scripts/resolve/main/example.py
746
746
```
747
747
748
748
UV scripts are Python scripts that include their dependencies directly in the file using a special comment syntax. This makes them perfect for self-contained tasks that don't require complex project setups. Learn more about UV scripts in the [UV documentation](https://docs.astral.sh/uv/guides/scripts/).
0 commit comments