|
2 | 2 |
|
3 | 3 | 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. |
4 | 4 |
|
| 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 | + |
5 | 23 | ## HuggingFace token (`HF_TOKEN`) |
6 | 24 |
|
7 | 25 | Required for gated models (e.g., Llama, Mistral, some Nemotron variants) and gated datasets (e.g., GPQA, HLE). |
8 | 26 |
|
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): |
10 | 28 |
|
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 | + ``` |
14 | 41 |
|
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. |
16 | 43 |
|
17 | 44 | ## NGC API key (for `nvcr.io`) |
18 | 45 |
|
|
0 commit comments