Skip to content

Commit 5754b3d

Browse files
Docs: link to jobs cli docs (#3253)
* link to jobs cli docs * Update docs/source/en/guides/jobs.md Co-authored-by: célina <[email protected]> --------- Co-authored-by: célina <[email protected]>
1 parent 99b2325 commit 5754b3d

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

docs/source/en/guides/jobs.md

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,29 @@ A job runs on Hugging Face infrastructure and are defined with a command to run
1515
If you want to run and manage a job on the Hub, your machine must be logged in. If you are not, please refer to
1616
[this section](../quick-start#authentication). In the rest of this guide, we will assume that your machine is logged in.
1717

18+
## Jobs Command Line Interface
19+
20+
Use the [`hf jobs` CLI](./cli#hf-jobs) to run Jobs from the command line, and pass `--flavor` to specify your hardware.
21+
22+
`hf jobs run` runs Jobs with a Docker image and a command with a familiar Docker-like interface. Think `docker run`, but for running code on any hardware:
23+
24+
```bash
25+
>>> hf jobs run python:12 -c "print('Hello world!')"
26+
>>> hf jobs run --flavor a10g-small pytorch/pytorch:2.6.0-cuda12.4-cudnn9-devel python -c "import torch; print(torch.cuda.get_device_name())"
27+
```
28+
29+
Use `hf jobs uv run` to run local or remote UV scripts:
30+
31+
```bash
32+
>>> hf jobs uv run my_script.py
33+
>>> hf jobs uv run --flavor a10g-small "https://raw.githubusercontent.com/huggingface/trl/main/trl/scripts/sft.py"
34+
```
35+
36+
UV scripts are Python scripts that include their dependencies directly in the file using a special comment syntax defined in the [UV documentation](https://docs.astral.sh/uv/guides/scripts/).
37+
38+
Now the rest of this guide will show you the python API.
39+
If you would like to view all the available `hf jobs` commands and options instead, check out the [guide on the `hf jobs` command line interface](./cli#hf-jobs).
40+
1841
## Run a Job
1942

2043
Run compute Jobs defined with a command and a Docker Image on Hugging Face infrastructure (including GPUs and TPUs).
@@ -57,12 +80,6 @@ This feature is pay-as-you-go: you only pay for the seconds you use.
5780
>>> run_uv_job("my_script.py")
5881
```
5982

60-
<Tip>
61-
62-
Use [hf jobs](./cli#hf-jobs) to run jobs in the command line.
63-
64-
</Tip>
65-
6683
[`run_job`] returns the [`JobInfo`] which has the URL of the Job on Hugging Face, where you can see the Job status and the logs.
6784
Save the Job ID from [`JobInfo`] to manage the job:
6885

0 commit comments

Comments
 (0)