Skip to content

Commit 2c4d0f1

Browse files
snowmeadclaude
andcommitted
Add CLI syntax documentation for hf jobs commands
Document correct CLI syntax to prevent common mistakes: - Command order: `hf jobs uv run` (not `hf jobs run uv`) - Flags must come BEFORE script URL - Use `--secrets` (plural), not `--secret` 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 0499fae commit 2c4d0f1

File tree

1 file changed

+47
-4
lines changed
  • hf-llm-trainer/skills/model-trainer

1 file changed

+47
-4
lines changed

hf-llm-trainer/skills/model-trainer/SKILL.md

Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -271,12 +271,55 @@ hub_repo_details(["uv-scripts/classification"], repo_type="dataset", include_rea
271271

272272
**Popular collections:** ocr, classification, synthetic-data, vllm, dataset-creation
273273

274-
### Approach 3: TRL Jobs Package (For Terminal Use)
274+
### Approach 3: HF Jobs CLI (Direct Terminal Commands)
275275

276-
The `trl-jobs` package provides optimized defaults and one-liner training. **Note: This approach uses bash commands, not `hf_jobs()` MCP tool.**
276+
When the `hf_jobs()` MCP tool is unavailable, use the `hf jobs` CLI directly.
277+
278+
**⚠️ CRITICAL: CLI Syntax Rules**
279+
280+
```bash
281+
# ✅ CORRECT syntax - flags BEFORE script URL
282+
hf jobs uv run --flavor a10g-large --timeout 2h --secrets HF_TOKEN "https://example.com/train.py"
283+
284+
# ❌ WRONG - "run uv" instead of "uv run"
285+
hf jobs run uv "https://example.com/train.py" --flavor a10g-large
286+
287+
# ❌ WRONG - flags AFTER script URL (will be ignored!)
288+
hf jobs uv run "https://example.com/train.py" --flavor a10g-large
289+
290+
# ❌ WRONG - "--secret" instead of "--secrets" (plural)
291+
hf jobs uv run --secret HF_TOKEN "https://example.com/train.py"
292+
```
293+
294+
**Key syntax rules:**
295+
1. Command order is `hf jobs uv run` (NOT `hf jobs run uv`)
296+
2. All flags (`--flavor`, `--timeout`, `--secrets`) must come BEFORE the script URL
297+
3. Use `--secrets` (plural), not `--secret`
298+
4. Script URL must be the last positional argument
299+
300+
**Complete CLI example:**
301+
```bash
302+
hf jobs uv run \
303+
--flavor a10g-large \
304+
--timeout 2h \
305+
--secrets HF_TOKEN \
306+
"https://huggingface.co/user/repo/resolve/main/train.py"
307+
```
308+
309+
**Check job status via CLI:**
310+
```bash
311+
hf jobs ps # List all jobs
312+
hf jobs logs <job-id> # View logs
313+
hf jobs inspect <job-id> # Job details
314+
hf jobs cancel <job-id> # Cancel a job
315+
```
316+
317+
### Approach 4: TRL Jobs Package (Simplified Training)
318+
319+
The `trl-jobs` package provides optimized defaults and one-liner training.
277320

278321
```bash
279-
# Install (users only, not needed for this environment)
322+
# Install
280323
pip install trl-jobs
281324

282325
# Train with SFT (simplest possible)
@@ -289,7 +332,7 @@ trl-jobs sft \
289332
**When to use:** User working in terminal directly (not Claude Code context), quick local experimentation
290333
**Repository:** https://github.com/huggingface/trl-jobs
291334

292-
⚠️ **In Claude Code context, use Approach 1 (UV Scripts) with `hf_jobs()` instead.**
335+
⚠️ **In Claude Code context, prefer using `hf_jobs()` MCP tool (Approach 1) when available.**
293336

294337
## Hardware Selection
295338

0 commit comments

Comments
 (0)