davanstrien HF Staff commited on
Commit
e5f9638
·
verified ·
1 Parent(s): a687b33

Fish twin blocks

Browse files
Files changed (1) hide show
  1. README.md +81 -6
README.md CHANGED
@@ -15,7 +15,7 @@ The Hugging Face CLI is a powerful tool for interacting with the Hub. It allows
15
 
16
  Humans and agents can often discover how to use it via the `--help` command and the hints the CLI outputs. However, there are some cool tricks you might not discover straight away. This is a cheat sheet for them!
17
 
18
- Notes. Every line was run against `hf` 1.29 on 2026-09-16, with public ids where possible; lines with `YOU/...` need your own ids. Start a session with `hf auth whoami`. Lines are bash and zsh; loops use `xargs`, so most also run in fish unchanged. The four recipes that set variables carry a fish line, and the substitutions are listed under Patterns. Listings take `--json`, `-`-format quiet``, `--sort` and `--limit`; the default limit is 30 on models and datasets, 100 on jobs, 10 on collections.
19
 
20
  ## Lineage: walk the graph between models, datasets, papers, and providers
21
 
@@ -106,6 +106,14 @@ hf models ls --search ocr --sort created_at --limit 500 --json \
106
  | jq -r --arg d "$D" '[.[] | select(.created_at > $d)] | sort_by(-.likes)[:10][] | "\(.likes)\t\(.created_at[:10])\t\(.id)"'
107
  ```
108
 
 
 
 
 
 
 
 
 
109
  Same idea for a whole task in the last year.
110
 
111
  ```bash
@@ -114,6 +122,14 @@ hf models ls --pipeline-tag image-text-to-text --sort created_at --limit 1000 --
114
  | jq -r --arg d "$D" '[.[] | select(.created_at > $d)] | sort_by(-.likes)[:10][] | "\(.likes)\t\(.id)"'
115
  ```
116
 
 
 
 
 
 
 
 
 
117
  Tag namespaces `--filter` accepts but `--help` never lists: `license:`, `dataset:`, `arxiv:`, `base_model:`, plus bare language codes and library names.
118
 
119
  ```bash
@@ -352,6 +368,14 @@ hf jobs inspect $J --json | jq -r '.[0].status.stage'
352
  hf jobs logs $J -f
353
  ```
354
 
 
 
 
 
 
 
 
 
355
  Label at launch, filter later. A sweep becomes a queryable set. uv run prints id=... on stdout; extract it.
356
 
357
  ```bash
@@ -359,6 +383,13 @@ J=$(hf jobs uv run --flavor cpu-basic --label run=sweep42 --label model=qwen3-8b
359
  hf jobs ps -a --label run=sweep42 --json | jq -r '.[] | "\(.id)\t\(.status)"'
360
  ```
361
 
 
 
 
 
 
 
 
362
  Block until every job succeeds, then chain. Exit 0 only if all completed. `hf jobs hardware` lists flavors with $/hour.
363
 
364
  ```bash
@@ -414,6 +445,17 @@ hf endpoints update $E --container-args "--enable-auto-tool-choice --tool-call-p
414
  hf endpoints scale-to-zero $E
415
  ```
416
 
 
 
 
 
 
 
 
 
 
 
 
417
  or the name you deployed above
418
 
419
  State and URL of your endpoints, ready for an OpenAI-compatible client.
@@ -547,6 +589,15 @@ hf models ls --filter automatic-speech-recognition --warm --limit 10 --format qu
547
  hf collections info $SLUG --json | jq '[.items[].item_id]'
548
  ```
549
 
 
 
 
 
 
 
 
 
 
550
  ## Recipes: a few lines chained together
551
 
552
  Each one was run on 2026-09-16. Change the ids to suit.
@@ -573,7 +624,13 @@ hf models ls --search ocr --no-gated --num-parameters max:4B --apps vllm --sort
573
  | jq -r --arg d "$D" '[.[] | select(.created_at > $d)] | sort_by(-.likes)[:10][] | "\(.likes)\t\(.created_at[:10])\t\(.id)"'
574
  ```
575
 
576
- Fish: `set D (date -v-2m +%F 2>/dev/null; or date -d '2 months ago' +%F)`
 
 
 
 
 
 
577
 
578
  **3.** "From a paper to a live API." Paper -> most liked model citing it that is warm -> which provider serves it.
579
 
@@ -583,7 +640,13 @@ hf models info $M --expand inferenceProviderMapping --json | jq -r '.inference_p
583
  # Qwen/Qwen3-8B on nscale, featherless-ai
584
  ```
585
 
586
- Fish: `set M (hf models ls … --format quiet)`
 
 
 
 
 
 
587
 
588
  **4.** "Which GGUF fits a 16 GB card?" Sizes without downloading, largest that fits first.
589
 
@@ -630,7 +693,14 @@ done
630
  hf jobs ps -a --label run=sweep42 --format quiet | xargs hf jobs wait --timeout 2h && hf buckets sync hf://buckets/YOU/sweep42 ./sweep42
631
  ```
632
 
633
- Fish: `for m in …; <same line>; end`
 
 
 
 
 
 
 
634
 
635
  **10.** "Which trending papers have a model you can call right now?" Top 100 trending papers -> any warm model citing each. 100 calls, 8 in parallel, about 10 s.
636
 
@@ -648,11 +718,16 @@ SLUG=$(hf collections create "Warm OCR models under 4B, Sep 2026" --private --js
648
  hf models ls --search ocr --warm --num-parameters max:4B --sort likes --limit 10 --format quiet | xargs -I{} hf collections add-item $SLUG {} model --format quiet
649
  ```
650
 
651
- Fish: `set SLUG (hf collections create … | jq -r .slug)`
 
 
 
 
 
652
 
653
  ## Patterns
654
 
655
- - Fish users: three substitutions cover every line here. `X=$(cmd)` becomes `set X (cmd)`; `a || b` becomes `a; or b`; `for x in …; do …; done` becomes `for x in …; …; end`. `alias`, `$(…)` inside `sh `-c` '…'`, and `jq `--arg` d "$D"` work unchanged. Or run any line as `bash `-c` '…'`.
656
 
657
  - `-`-format quiet`` when the next step is another command. `-`-json` | jq` when you need fields. Human output for the final answer only.
658
  - Sort by `created_at` or `trending_score` before you recommend a model. Default order is not recency.
 
15
 
16
  Humans and agents can often discover how to use it via the `--help` command and the hints the CLI outputs. However, there are some cool tricks you might not discover straight away. This is a cheat sheet for them!
17
 
18
+ Notes. Every line was run against `hf` 1.29 on 2026-09-16, with public ids where possible; lines with `YOU/...` need your own ids. Start a session with `hf auth whoami`. Lines are bash and zsh; loops use `xargs`, so most also run in fish unchanged. Blocks that set a variable have a fish twin underneath. Listings take `--json`, `-`-format quiet``, `--sort` and `--limit`; the default limit is 30 on models and datasets, 100 on jobs, 10 on collections.
19
 
20
  ## Lineage: walk the graph between models, datasets, papers, and providers
21
 
 
106
  | jq -r --arg d "$D" '[.[] | select(.created_at > $d)] | sort_by(-.likes)[:10][] | "\(.likes)\t\(.created_at[:10])\t\(.id)"'
107
  ```
108
 
109
+ Fish:
110
+
111
+ ```fish
112
+ set D (date -v-3m +%F 2>/dev/null || date -d '3 months ago' +%F)
113
+ hf models ls --search ocr --sort created_at --limit 500 --json \
114
+ | jq -r --arg d "$D" '[.[] | select(.created_at > $d)] | sort_by(-.likes)[:10][] | "\(.likes)\t\(.created_at[:10])\t\(.id)"'
115
+ ```
116
+
117
  Same idea for a whole task in the last year.
118
 
119
  ```bash
 
122
  | jq -r --arg d "$D" '[.[] | select(.created_at > $d)] | sort_by(-.likes)[:10][] | "\(.likes)\t\(.id)"'
123
  ```
124
 
125
+ Fish:
126
+
127
+ ```fish
128
+ set D (date -v-12m +%F 2>/dev/null || date -d '12 months ago' +%F)
129
+ hf models ls --pipeline-tag image-text-to-text --sort created_at --limit 1000 --json \
130
+ | jq -r --arg d "$D" '[.[] | select(.created_at > $d)] | sort_by(-.likes)[:10][] | "\(.likes)\t\(.id)"'
131
+ ```
132
+
133
  Tag namespaces `--filter` accepts but `--help` never lists: `license:`, `dataset:`, `arxiv:`, `base_model:`, plus bare language codes and library names.
134
 
135
  ```bash
 
368
  hf jobs logs $J -f
369
  ```
370
 
371
+ Fish:
372
+
373
+ ```fish
374
+ set J (hf jobs ps -a --json --limit 0 | jq -r 'max_by(.created_at) | .id')
375
+ hf jobs inspect $J --json | jq -r '.[0].status.stage'
376
+ hf jobs logs $J -f
377
+ ```
378
+
379
  Label at launch, filter later. A sweep becomes a queryable set. uv run prints id=... on stdout; extract it.
380
 
381
  ```bash
 
383
  hf jobs ps -a --label run=sweep42 --json | jq -r '.[] | "\(.id)\t\(.status)"'
384
  ```
385
 
386
+ Fish:
387
+
388
+ ```fish
389
+ set J (hf jobs uv run --flavor cpu-basic --label run=sweep42 --label model=qwen3-8b --detach train.py 2>/dev/null | grep -oE '^id=[a-f0-9]+' | cut -d= -f2)
390
+ hf jobs ps -a --label run=sweep42 --json | jq -r '.[] | "\(.id)\t\(.status)"'
391
+ ```
392
+
393
  Block until every job succeeds, then chain. Exit 0 only if all completed. `hf jobs hardware` lists flavors with $/hour.
394
 
395
  ```bash
 
445
  hf endpoints scale-to-zero $E
446
  ```
447
 
448
+ Fish:
449
+
450
+ ```fish
451
+ set E (hf endpoints ls --format quiet | head -1)
452
+ hf endpoints describe $E --json | jq '{compute, model: .model.image}'
453
+ hf endpoints update $E --min-replica 0 --max-replica 2 --scale-to-zero-timeout 15
454
+ hf endpoints update $E --tensor-parallel-size 2
455
+ hf endpoints update $E --container-args "--enable-auto-tool-choice --tool-call-parser hermes --max-model-len 32768"
456
+ hf endpoints scale-to-zero $E
457
+ ```
458
+
459
  or the name you deployed above
460
 
461
  State and URL of your endpoints, ready for an OpenAI-compatible client.
 
589
  hf collections info $SLUG --json | jq '[.items[].item_id]'
590
  ```
591
 
592
+ Fish:
593
+
594
+ ```fish
595
+ set SLUG (hf collections create "Warm ASR models, Sep 2026" --private --json | jq -r '.slug')
596
+ hf models ls --filter automatic-speech-recognition --warm --limit 10 --format quiet \
597
+ | xargs -I{} hf collections add-item $SLUG {} model --format quiet
598
+ hf collections info $SLUG --json | jq '[.items[].item_id]'
599
+ ```
600
+
601
  ## Recipes: a few lines chained together
602
 
603
  Each one was run on 2026-09-16. Change the ids to suit.
 
624
  | jq -r --arg d "$D" '[.[] | select(.created_at > $d)] | sort_by(-.likes)[:10][] | "\(.likes)\t\(.created_at[:10])\t\(.id)"'
625
  ```
626
 
627
+ Fish:
628
+
629
+ ```fish
630
+ set D (date -v-2m +%F 2>/dev/null || date -d '2 months ago' +%F)
631
+ hf models ls --search ocr --no-gated --num-parameters max:4B --apps vllm --sort created_at --limit 300 --json \
632
+ | jq -r --arg d "$D" '[.[] | select(.created_at > $d)] | sort_by(-.likes)[:10][] | "\(.likes)\t\(.created_at[:10])\t\(.id)"'
633
+ ```
634
 
635
  **3.** "From a paper to a live API." Paper -> most liked model citing it that is warm -> which provider serves it.
636
 
 
640
  # Qwen/Qwen3-8B on nscale, featherless-ai
641
  ```
642
 
643
+ Fish:
644
+
645
+ ```fish
646
+ set M (hf models ls --filter arxiv:2505.09388 --warm --sort likes --limit 1 --format quiet)
647
+ hf models info $M --expand inferenceProviderMapping --json | jq -r '.inference_provider_mapping[] | select(.status=="live") | "\(.provider)\t\(.task)"'
648
+ # Qwen/Qwen3-8B on nscale, featherless-ai
649
+ ```
650
 
651
  **4.** "Which GGUF fits a 16 GB card?" Sizes without downloading, largest that fits first.
652
 
 
693
  hf jobs ps -a --label run=sweep42 --format quiet | xargs hf jobs wait --timeout 2h && hf buckets sync hf://buckets/YOU/sweep42 ./sweep42
694
  ```
695
 
696
+ Fish:
697
+
698
+ ```fish
699
+ for m in Qwen/Qwen3-8B Qwen/Qwen3-4B Qwen/Qwen3-1.7B
700
+ hf jobs uv run --flavor l4x1 -s HF_TOKEN --label run=sweep42 --label model=$m --detach eval.py $m hf://buckets/YOU/sweep42 2>/dev/null | grep -oE '^id=[a-f0-9]+'
701
+ end
702
+ hf jobs ps -a --label run=sweep42 --format quiet | xargs hf jobs wait --timeout 2h && hf buckets sync hf://buckets/YOU/sweep42 ./sweep42
703
+ ```
704
 
705
  **10.** "Which trending papers have a model you can call right now?" Top 100 trending papers -> any warm model citing each. 100 calls, 8 in parallel, about 10 s.
706
 
 
718
  hf models ls --search ocr --warm --num-parameters max:4B --sort likes --limit 10 --format quiet | xargs -I{} hf collections add-item $SLUG {} model --format quiet
719
  ```
720
 
721
+ Fish:
722
+
723
+ ```fish
724
+ set SLUG (hf collections create "Warm OCR models under 4B, Sep 2026" --private --json | jq -r '.slug')
725
+ hf models ls --search ocr --warm --num-parameters max:4B --sort likes --limit 10 --format quiet | xargs -I{} hf collections add-item $SLUG {} model --format quiet
726
+ ```
727
 
728
  ## Patterns
729
 
730
+ - Fish users: every block that sets a variable has a fish twin underneath. Everything else runs unchanged; the only bash-isms fish rejects are `X=$(cmd)` and `for … do … done`.
731
 
732
  - `-`-format quiet`` when the next step is another command. `-`-json` | jq` when you need fields. Human output for the final answer only.
733
  - Sort by `created_at` or `trending_score` before you recommend a model. Default order is not recency.