Skip to content

Commit 634ac7d

Browse files
committed
Update credentials.md per @mxinO review on PR #1239
Two small additions: 1. New "Check what's already set first" section — most users already have HF_TOKEN, docker login, or enroot credentials in place from prior work. Provides four one-liner detection commands so the agent skips sections that are already configured. 2. Document `hf auth login` as the recommended interactive way to persist the HF token at `~/.cache/huggingface/token`. The HF Python client and `transformers`/`datasets` read this file automatically — many users never need HF_TOKEN in env. Kept the env-var path as option 2 for scripts/CI and remote sessions. Signed-off-by: Zhiyu Cheng <zhiyuc@nvidia.com>
1 parent 86adcf4 commit 634ac7d

1 file changed

Lines changed: 32 additions & 5 deletions

File tree

.claude/skills/common/credentials.md

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,44 @@
22

33
Tokens and registry credentials that ModelOpt workflows need across local and cluster environments. Not SLURM-specific — referenced from PTQ, deployment, evaluation, and slurm-setup skills.
44

5+
## Check what's already set first
6+
7+
Before configuring anything, check what the user already has — many of these are likely in place from prior `hf auth login`, `docker login`, or previous SLURM work. Skip any section below for which credentials are already present.
8+
9+
```bash
10+
# HF token: env var or persisted from `hf auth login`
11+
[ -n "$HF_TOKEN" ] && echo "✓ HF_TOKEN set in env"
12+
[ -s ~/.cache/huggingface/token ] && echo "✓ HF token at ~/.cache/huggingface/token (from 'hf auth login')"
13+
14+
# Docker / NGC registry credentials
15+
grep -qE '"(nvcr\.io|https://index\.docker\.io)"' ~/.docker/config.json 2>/dev/null && echo "✓ Docker login present"
16+
17+
# Enroot / pyxis credentials (on cluster login node, for SLURM users)
18+
grep -qE '^machine nvcr\.io ' ~/.config/enroot/.credentials 2>/dev/null && echo "✓ Enroot NGC entry present"
19+
```
20+
21+
For remote clusters, run the same checks via SSH (`ssh <cluster-login> '<check>'`) — credentials live on the cluster, not your workstation.
22+
523
## HuggingFace token (`HF_TOKEN`)
624

725
Required for gated models (e.g., Llama, Mistral, some Nemotron variants) and gated datasets (e.g., GPQA, HLE).
826

9-
Generate at <https://huggingface.co/settings/tokens>, then export:
27+
Generate at <https://huggingface.co/settings/tokens>. Two persistence options (you can use either or both):
1028

11-
```bash
12-
export HF_TOKEN=hf_...
13-
```
29+
1. **`hf auth login`** (recommended for interactive use) — stores the token at `~/.cache/huggingface/token`. The HF Python client picks it up automatically; `transformers`, `datasets`, and the `hf` CLI all read this file without needing `HF_TOKEN` in the env.
30+
31+
```bash
32+
pip install -U huggingface_hub
33+
hf auth login # paste the token interactively
34+
```
35+
36+
2. **Environment variable** (good for scripts, CI, and remote sessions):
37+
38+
```bash
39+
export HF_TOKEN=hf_...
40+
```
1441

15-
Persist in `~/.bashrc` or a project-local `.env` file. For remote clusters, check whether the cluster's shell config already sets it: `ssh <cluster-login> 'env | grep -c HF_TOKEN'`.
42+
Persist in `~/.bashrc` or a project-local `.env` file. `HF_TOKEN` takes precedence when both are present.
1643

1744
## NGC API key (for `nvcr.io`)
1845

0 commit comments

Comments
 (0)