huggingface/trl-jobs

Train LLM on Hugging Face infra

72

stars

46

commits

Python

primary language

May 26, 2026

updated

README

๐Ÿญ TRL Jobs

TRL Jobs is a simple wrapper around Hugging Face Jobs that makes it easy to run TRL (Transformer Reinforcement Learning) workflows directly on ๐Ÿค— Hugging Face infrastructure.

Think of it as the quickest way to kick off Supervised Fine-Tuning (SFT) and more, without worrying about all the boilerplate setup.

๐Ÿ“ฆ Installation

Get started with a single command:

pip install trl-jobs

โšก Quick Start

Run your first supervised fine-tuning job in just one line:

trl-jobs sft --model_name Qwen/Qwen3-0.6B --dataset_name trl-lib/Capybara

The training is tracked with Trackio and the fine-tuned model is automatically pushed to the ๐Ÿค— Hub.

trackio_sft trained_model_sft

๐Ÿ›  Available Commands

Right now, SFT (Supervised Fine-Tuning) is supported. More workflows will be added soon!

๐Ÿ”น SFT (Supervised Fine-Tuning)

trl-jobs sft --model_name Qwen/Qwen3-0.6B --dataset_name trl-lib/Capybara

Required arguments

  • --model_name โ†’ Model to fine-tune (e.g. Qwen/Qwen3-0.6B)
  • --dataset_name โ†’ Dataset to train on (e.g. trl-lib/Capybara)

Optional arguments

  • --peft โ†’ Use PEFT (LoRA) (default: False)
  • --flavor โ†’ Hardware flavor (default: a100-large, only option for now)
  • --timeout โ†’ Max runtime (1h by default). Supports s, m, h, d
  • -d, --detach โ†’ Run in background and print job ID
  • --namespace โ†’ Namespace where the job will run (default: your user namespace)
  • --token โ†’ Hugging Face token (only needed if not logged in)

โžก๏ธ You can also pass any arguments supported by trl sft. E.g.

trl-jobs sft --model_name Qwen/Qwen3-0.6B --dataset_name trl-lib/Capybara --learning_rate 3e-5

For the full list, see the TRL CLI docs.

Dataset format

SFT supports various 4 dataset formats.

  • Standard language modeling

    example = {"text": "The sky is blue."}
    
  • Standard prompt-completion

    example = {"prompt": "The sky is", "completion": " blue."}
    
  • Conversationanl language modeling

    example = {"messages": [
        {"role": "user", "content": "What color is the sky?"},
        {"role": "assistant", "content": "It is blue."}
    ]}
    
  • Conversational prompt-completion

    example = {"prompt": [{"role": "user", "content": "What color is the sky?"}],
               "completion": [{"role": "assistant", "content": "It is blue."}]}
    

[!IMPORTANT] When using conversational dataset, ensure that the model has a chat template.

[!NOTE] When using prompt-completion dataset, the loss is only computed on the completion part.

For more details, see the TRL docs - Dataset formats.

๐Ÿ“Š Supported Configurations

Here are some ready-to-go setups you can use out of the box.

๐Ÿฆ™ Meta LLaMA 3

ModelMax context lengthTokens / batchExample command
Meta-Llama-3-8B4096262,144trl-jobs sft --model_name meta-llama/Meta-Llama-3-8B --dataset_name ...
Meta-Llama-3-8B-Instruct4096262,144trl-jobs sft --model_name meta-llama/Meta-Llama-3-8B-Instruct --dataset_name ...

๐Ÿฆ™ Meta LLaMA 3 with PEFT

ModelMax context lengthTokens / batchExample command
Meta-Llama-3-8B24,576196,608trl-jobs sft --model_name meta-llama/Meta-Llama-3-8B --peft --dataset_name ...
Meta-Llama-3-8B-Instruct24,576196,608trl-jobs sft --model_name meta-llama/Meta-Llama-3-8B-Instruct --peft --dataset_name ...

๐Ÿง Qwen3

ModelMax context lengthTokens / batchExample command
Qwen3-0.6B-Base32,76865,536trl-jobs sft --model_name Qwen/Qwen3-0.6B-Base --dataset_name ...
Qwen3-0.6B32,76865,536trl-jobs sft --model_name Qwen/Qwen3-0.6B --dataset_name ...
Qwen3-1.7B-Base24,57698,304trl-jobs sft --model_name Qwen/Qwen3-1.7B-Base --dataset_name ...
Qwen3-1.7B24,57698,304trl-jobs sft --model_name Qwen/Qwen3-1.7B --dataset_name ...
Qwen3-4B-Base20,480163,840trl-jobs sft --model_name Qwen/Qwen3-4B-Base --dataset_name ...
Qwen3-4B20,480163,840trl-jobs sft --model_name Qwen/Qwen3-4B --dataset_name ...
Qwen3-8B-Base4,096262,144trl-jobs sft --model_name Qwen/Qwen3-8B-Base --dataset_name ...
Qwen3-8B4,096262,144trl-jobs sft --model_name Qwen/Qwen3-8B --dataset_name ...

๐Ÿง Qwen3 with PEFT

ModelMax context lengthTokens / batchExample command
Qwen3-8B-Base24,576196,608trl-jobs sft --model_name Qwen/Qwen3-8B-Base --peft --dataset_name ...
Qwen3-8B24,576196,608trl-jobs sft --model_name Qwen/Qwen3-8B --peft --dataset_name ...
Qwen3-14B-Base20,480163,840trl-jobs sft --model_name Qwen/Qwen3-14B-Base --peft --dataset_name ...
Qwen3-14B20,480163,840trl-jobs sft --model_name Qwen/Qwen3-14B --peft --dataset_name ...
Qwen3-32B4,096131,072trl-jobs sft --model_name Qwen/Qwen3-32B --peft --dataset_name ...

SmolLM3

ModelMax context lengthTokens / batchExample command
HuggingFaceTB/SmolLM3-3B-Base28,672114,688trl-jobs sft --model_name HuggingFaceTB/SmolLM3-3B --dataset_name ...
HuggingFaceTB/SmolLM3-3B28,672114,688trl-jobs sft --model_name HuggingFaceTB/SmolLM3-3B --dataset_name ...

๐Ÿค– OpenAI GPT-OSS (with PEFT)

๐Ÿšง Coming soon!

๐Ÿ’ก Want support for another model?

Open an issue or submit a PRโ€”weโ€™d love to hear from you!

๐Ÿ”‘ Authentication

Youโ€™ll need a Hugging Face token to run jobs. You can provide it in any of these ways:

  1. Login with huggingface-cli login
  2. Set the environment variable HF_TOKEN
  3. Pass it directly with --token

๐Ÿ“œ License

This project is under the MIT License. See the LICENSE file for details.

๐Ÿค Contributing

We welcome contributions! Please open an issue or a PR on GitHub.

Before committing, run formatting checks:

ruff check . --fix && ruff format . --line-length 119

Contributors

qgallouedec

43 commits

sergiopaniego

2 commits

paulinebm

1 commits

huggingface/trl-jobs

Train LLM on Hugging Face infra

72

stars

46

commits

Python

primary language

May 26, 2026

updated

README

๐Ÿญ TRL Jobs

TRL Jobs is a simple wrapper around Hugging Face Jobs that makes it easy to run TRL (Transformer Reinforcement Learning) workflows directly on ๐Ÿค— Hugging Face infrastructure.

Think of it as the quickest way to kick off Supervised Fine-Tuning (SFT) and more, without worrying about all the boilerplate setup.

๐Ÿ“ฆ Installation

Get started with a single command:

pip install trl-jobs

โšก Quick Start

Run your first supervised fine-tuning job in just one line:

trl-jobs sft --model_name Qwen/Qwen3-0.6B --dataset_name trl-lib/Capybara

The training is tracked with Trackio and the fine-tuned model is automatically pushed to the ๐Ÿค— Hub.

trackio_sft trained_model_sft

๐Ÿ›  Available Commands

Right now, SFT (Supervised Fine-Tuning) is supported. More workflows will be added soon!

๐Ÿ”น SFT (Supervised Fine-Tuning)

trl-jobs sft --model_name Qwen/Qwen3-0.6B --dataset_name trl-lib/Capybara

Required arguments

  • --model_name โ†’ Model to fine-tune (e.g. Qwen/Qwen3-0.6B)
  • --dataset_name โ†’ Dataset to train on (e.g. trl-lib/Capybara)

Optional arguments

  • --peft โ†’ Use PEFT (LoRA) (default: False)
  • --flavor โ†’ Hardware flavor (default: a100-large, only option for now)
  • --timeout โ†’ Max runtime (1h by default). Supports s, m, h, d
  • -d, --detach โ†’ Run in background and print job ID
  • --namespace โ†’ Namespace where the job will run (default: your user namespace)
  • --token โ†’ Hugging Face token (only needed if not logged in)

โžก๏ธ You can also pass any arguments supported by trl sft. E.g.

trl-jobs sft --model_name Qwen/Qwen3-0.6B --dataset_name trl-lib/Capybara --learning_rate 3e-5

For the full list, see the TRL CLI docs.

Dataset format

SFT supports various 4 dataset formats.

  • Standard language modeling

    example = {"text": "The sky is blue."}
    
  • Standard prompt-completion

    example = {"prompt": "The sky is", "completion": " blue."}
    
  • Conversationanl language modeling

    example = {"messages": [
        {"role": "user", "content": "What color is the sky?"},
        {"role": "assistant", "content": "It is blue."}
    ]}
    
  • Conversational prompt-completion

    example = {"prompt": [{"role": "user", "content": "What color is the sky?"}],
               "completion": [{"role": "assistant", "content": "It is blue."}]}
    

[!IMPORTANT] When using conversational dataset, ensure that the model has a chat template.

[!NOTE] When using prompt-completion dataset, the loss is only computed on the completion part.

For more details, see the TRL docs - Dataset formats.

๐Ÿ“Š Supported Configurations

Here are some ready-to-go setups you can use out of the box.

๐Ÿฆ™ Meta LLaMA 3

ModelMax context lengthTokens / batchExample command
Meta-Llama-3-8B4096262,144trl-jobs sft --model_name meta-llama/Meta-Llama-3-8B --dataset_name ...
Meta-Llama-3-8B-Instruct4096262,144trl-jobs sft --model_name meta-llama/Meta-Llama-3-8B-Instruct --dataset_name ...

๐Ÿฆ™ Meta LLaMA 3 with PEFT

ModelMax context lengthTokens / batchExample command
Meta-Llama-3-8B24,576196,608trl-jobs sft --model_name meta-llama/Meta-Llama-3-8B --peft --dataset_name ...
Meta-Llama-3-8B-Instruct24,576196,608trl-jobs sft --model_name meta-llama/Meta-Llama-3-8B-Instruct --peft --dataset_name ...

๐Ÿง Qwen3

ModelMax context lengthTokens / batchExample command
Qwen3-0.6B-Base32,76865,536trl-jobs sft --model_name Qwen/Qwen3-0.6B-Base --dataset_name ...
Qwen3-0.6B32,76865,536trl-jobs sft --model_name Qwen/Qwen3-0.6B --dataset_name ...
Qwen3-1.7B-Base24,57698,304trl-jobs sft --model_name Qwen/Qwen3-1.7B-Base --dataset_name ...
Qwen3-1.7B24,57698,304trl-jobs sft --model_name Qwen/Qwen3-1.7B --dataset_name ...
Qwen3-4B-Base20,480163,840trl-jobs sft --model_name Qwen/Qwen3-4B-Base --dataset_name ...
Qwen3-4B20,480163,840trl-jobs sft --model_name Qwen/Qwen3-4B --dataset_name ...
Qwen3-8B-Base4,096262,144trl-jobs sft --model_name Qwen/Qwen3-8B-Base --dataset_name ...
Qwen3-8B4,096262,144trl-jobs sft --model_name Qwen/Qwen3-8B --dataset_name ...

๐Ÿง Qwen3 with PEFT

ModelMax context lengthTokens / batchExample command
Qwen3-8B-Base24,576196,608trl-jobs sft --model_name Qwen/Qwen3-8B-Base --peft --dataset_name ...
Qwen3-8B24,576196,608trl-jobs sft --model_name Qwen/Qwen3-8B --peft --dataset_name ...
Qwen3-14B-Base20,480163,840trl-jobs sft --model_name Qwen/Qwen3-14B-Base --peft --dataset_name ...
Qwen3-14B20,480163,840trl-jobs sft --model_name Qwen/Qwen3-14B --peft --dataset_name ...
Qwen3-32B4,096131,072trl-jobs sft --model_name Qwen/Qwen3-32B --peft --dataset_name ...

SmolLM3

ModelMax context lengthTokens / batchExample command
HuggingFaceTB/SmolLM3-3B-Base28,672114,688trl-jobs sft --model_name HuggingFaceTB/SmolLM3-3B --dataset_name ...
HuggingFaceTB/SmolLM3-3B28,672114,688trl-jobs sft --model_name HuggingFaceTB/SmolLM3-3B --dataset_name ...

๐Ÿค– OpenAI GPT-OSS (with PEFT)

๐Ÿšง Coming soon!

๐Ÿ’ก Want support for another model?

Open an issue or submit a PRโ€”weโ€™d love to hear from you!

๐Ÿ”‘ Authentication

Youโ€™ll need a Hugging Face token to run jobs. You can provide it in any of these ways:

  1. Login with huggingface-cli login
  2. Set the environment variable HF_TOKEN
  3. Pass it directly with --token

๐Ÿ“œ License

This project is under the MIT License. See the LICENSE file for details.

๐Ÿค Contributing

We welcome contributions! Please open an issue or a PR on GitHub.

Before committing, run formatting checks:

ruff check . --fix && ruff format . --line-length 119

Contributors

qgallouedec

43 commits

sergiopaniego

2 commits

paulinebm

1 commits

Languages

Python

100.0%