toml-config

โดย huggingface

How to write and use TOML configs in prime-rl. Use when creating config files, running commands with configs, or overriding config values via CLI.

npx skills add https://github.com/huggingface/prime-rl --skill toml-config

TOML Config

All prime-rl commands use pydantic_config (tyro-backed) with TOML configs and CLI overrides.

Running with configs

# Load a config file with @ syntax
uv run inference @ configs/debug/infer.toml
uv run sft @ configs/debug/sft/train.toml
uv run rl @ configs/debug/rl/train.toml

# CLI overrides (take precedence over TOML)
uv run inference @ config.toml --model.name Qwen/Qwen3-0.6B --server.port 8001

# Boolean flags: no value needed
uv run inference --model.enforce-eager          # sets to true
uv run inference --no-model.enforce-eager       # sets to false

# CLI-only (no TOML file)
uv run inference --model.name Qwen/Qwen3-0.6B --model.max-model-len 2048

# Compose multiple config files (later files override earlier ones)
uv run rl @ examples/reverse_text/rl.toml @ examples/reverse_text/slurm_rl.toml

# Nested config files: load a config for a specific section
uv run rl --model @ model.toml --data @ data.toml

TOML structure

Top-level fields must come before any [section] header — this is a TOML rule.

# Top-level fields first
gpu_memory_utilization = 0.5
seed = 42

# Then sections
[model]
name = "Qwen/Qwen3-0.6B"
max_model_len = 4096

[server]
port = 8000

Putting a top-level field after a section header nests it inside that section, which causes validation errors.

Setting None

Use the string "None" in TOML to set a field to None:

max_model_len = "None"

SLURM mode

Both rl and sft commands support SLURM execution via an optional [slurm] section. When present, the run is submitted as a SLURM job instead of running locally.

SLURM configs are composed with the base config via CLI:

uv run rl @ examples/reverse_text/rl.toml @ examples/reverse_text/slurm_rl.toml

RL SLURM

output_dir = "/shared/experiments/my-run"

[deployment]
type = "multi_node"
num_train_nodes = 2
num_infer_nodes = 1
gpus_per_node = 8
# nodes_per_fsdp_group = 1

[slurm]
job_name = "my-rl-job"
# dry_run = true          # generate script without submitting
# template_path = "path/to/custom.sh.j2"
# project_dir = "/path/to/project"

When [slurm] is set for RL:

  • output_dir must be explicitly set (the default outputs is rejected)
  • Teacher inference is not supported in multi-node deployment

SFT SLURM

output_dir = "/shared/experiments/my-sft-run"

[deployment]
type = "multi_node"
num_nodes = 2
gpus_per_node = 8
# nodes_per_fsdp_group = 1

[slurm]
job_name = "my-sft-job"
# dry_run = true
# template_path = "path/to/custom.sh.j2"
# project_dir = "/path/to/project"

SFT deployment follows the same pattern as RL:

  • [deployment] configures node/GPU allocation (single_node default or multi_node)
  • [slurm] configures SLURM submission (job name, partition, template)
  • output_dir must be explicitly set when using SLURM
  • Multi-node deployment requires [slurm] to be set

Available commands

All accept @ config.toml and CLI overrides:

CommandConfig classDescription
uv run rlfull RL pipelineOrchestrator + inference + trainer (local or SLURM)
uv run inferenceInferenceConfigvLLM inference server
uv run trainertrainer configRL trainer
uv run orchestratororchestrator configRollout orchestrator
uv run env-serverenv server configEnvironment server
uv run sftSFT configSupervised fine-tuning (local or SLURM)

Key files

  • src/prime_rl/utils/config.pyBaseConfig, cli, get_all_fields
  • src/prime_rl/entrypoints/rl.py — unified RL entrypoint (local + SLURM)
  • src/prime_rl/configs/rl.pyRLConfig, SlurmConfig, DeploymentConfig
  • src/prime_rl/entrypoints/sft.py — unified SFT entrypoint (local + SLURM)
  • src/prime_rl/configs/sft.pySFTConfig
  • configs/ — all config files, organized by task

Skills เพิ่มเติมจาก huggingface

Hugging Face Cli
huggingface
Execute Hugging Face Hub operations using the `hf` CLI. Use when the user needs to download models/datasets/spaces, upload files to Hub repositories, create repos, manage local cache, or run compute jobs on HF infrastructure. Covers authentication, file transfers, repository creation, cache operations, and cloud compute.
official
Hugging Face Datasets
huggingface
สร้างและจัดการชุดข้อมูลบน Hugging Face Hub รองรับการเริ่มต้นพื้นที่เก็บข้อมูล การกำหนดคอนฟิก/พรอมต์ระบบ การสตรีมอัปเดตแถว และการค้นหา/แปลงชุดข้อมูลด้วย SQL ออกแบบมาให้ทำงานร่วมกับเซิร์ฟเวอร์ HF MCP สำหรับเวิร์กโฟลว์ชุดข้อมูลที่ครอบคลุม
official
Hugging Face Evaluation
huggingface
เพิ่มและจัดการผลการประเมินในการ์ดโมเดลของ Hugging Face รองรับการดึงตารางประเมินจากเนื้อหา README การนำเข้าคะแนนจาก Artificial Analysis API และการรันการประเมินโมเดลแบบกำหนดเองด้วย vLLM/lighteval ทำงานร่วมกับรูปแบบ metadata model-index
official
Hugging Face Jobs
huggingface
รันเวิร์กโหลดใดๆ บนโครงสร้างพื้นฐานของ Hugging Face Jobs ครอบคลุม UV scripts, งานที่ใช้ Docker, การเลือกฮาร์ดแวร์, การประมาณค่าใช้จ่าย, การยืนยันตัวตนด้วยโทเค็น, การจัดการความลับ, การกำหนดค่าไทม์เอาต์ และการคงอยู่ของผลลัพธ์ ออกแบบมาสำหรับเวิร์กโหลดคอมพิวต์ทั่วไป รวมถึงการประมวลผลข้อมูล, การอนุมาน, การทดลอง, งานแบบแบตช์ และงานที่ใช้ Python ใดๆ
official
Hugging Face Model Trainer
huggingface
ฝึกหรือปรับแต่งโมเดลภาษาโดยใช้ TRL (Transformer Reinforcement Learning) บนโครงสร้างพื้นฐานของ Hugging Face Jobs ครอบคลุมวิธีการฝึกอบรม SFT, DPO, GRPO และการสร้างแบบจำลองรางวัล รวมถึงการแปลงเป็น GGUF สำหรับการปรับใช้ในเครื่องท้องถิ่น มีคำแนะนำเกี่ยวกับการเตรียมชุดข้อมูล การเลือกฮาร์ดแวร์ การประมาณค่าใช้จ่าย และการคงอยู่ของโมเดล
official
Hugging Face Paper Publisher
huggingface
เผยแพร่และจัดการเอกสารวิจัยบน Hugging Face Hub รองรับการสร้างหน้าเอกสาร การเชื่อมโยงเอกสารกับโมเดล/ชุดข้อมูล การอ้างสิทธิ์การเป็นผู้เขียน และการสร้างบทความวิจัยแบบมาร์กดาวน์ระดับมืออาชีพ
official
Hugging Face Tool Builder
huggingface
สร้างสคริปต์และเครื่องมือที่สามารถนำกลับมาใช้ใหม่ได้โดยใช้ Hugging Face API มีประโยชน์เมื่อต้องการเชื่อมต่อหรือรวมการเรียก API หรือเมื่อต้องทำงานซ้ำๆ/อัตโนมัติ สร้างสคริปต์บรรทัดคำสั่งที่ใช้ซ้ำได้เพื่อดึงข้อมูล เพิ่มข้อมูล หรือประมวลผลข้อมูลจาก Hugging Face Hub
official
Hugging Face Trackio
huggingface
ติดตามและแสดงผลการทดลองฝึก ML ด้วย Trackio ใช้เมื่อบันทึกเมตริกระหว่างการฝึก (Python API) หรือดึง/วิเคราะห์เมตริกที่บันทึกไว้ (CLI) รองรับการแสดงผลแดชบอร์ดแบบเรียลไทม์ การซิงค์กับ HF Space และเอาต์พุต JSON สำหรับระบบอัตโนมัติ
official