llama-stack-mirror/docs/source/providers/post_training/inline_huggingface.md
Nehanth Narendrula cf73146132
Some checks failed
Integration Tests / discover-tests (push) Has been skipped
Integration Auth Tests / test-matrix (oauth2_token) (push) Failing after 7s
Integration Tests / record-tests (push) Has been skipped
Integration Tests / run-tests (push) Has been skipped
Vector IO Integration Tests / test-matrix (3.12, inline::milvus) (push) Failing after 22s
Python Package Build Test / build (3.13) (push) Failing after 16s
Test Llama Stack Build / generate-matrix (push) Successful in 19s
Vector IO Integration Tests / test-matrix (3.13, inline::milvus) (push) Failing after 21s
Vector IO Integration Tests / test-matrix (3.12, inline::sqlite-vec) (push) Failing after 31s
Test Llama Stack Build / build-custom-container-distribution (push) Failing after 32s
Test External API and Providers / test-external (venv) (push) Failing after 32s
Vector IO Integration Tests / test-matrix (3.13, remote::chromadb) (push) Failing after 36s
Vector IO Integration Tests / test-matrix (3.12, remote::chromadb) (push) Failing after 39s
Update ReadTheDocs / update-readthedocs (push) Failing after 31s
SqlStore Integration Tests / test-postgres (3.13) (push) Failing after 42s
Test Llama Stack Build / build-single-provider (push) Failing after 37s
Test External Providers Installed via Module / test-external-providers-from-module (venv) (push) Failing after 35s
Test Llama Stack Build / build-ubi9-container-distribution (push) Failing after 37s
Vector IO Integration Tests / test-matrix (3.13, remote::pgvector) (push) Failing after 40s
Vector IO Integration Tests / test-matrix (3.12, remote::pgvector) (push) Failing after 42s
Unit Tests / unit-tests (3.12) (push) Failing after 36s
Vector IO Integration Tests / test-matrix (3.13, inline::sqlite-vec) (push) Failing after 40s
SqlStore Integration Tests / test-postgres (3.12) (push) Failing after 45s
Test Llama Stack Build / build (push) Failing after 6s
Python Package Build Test / build (3.12) (push) Failing after 1m1s
Unit Tests / unit-tests (3.13) (push) Failing after 1m0s
Vector IO Integration Tests / test-matrix (3.13, inline::faiss) (push) Failing after 1m6s
Vector IO Integration Tests / test-matrix (3.12, inline::faiss) (push) Failing after 1m8s
Pre-commit / pre-commit (push) Successful in 1m50s
feat: Enable DPO training with HuggingFace inline provider (#2825)
What does this PR do?

This PR adds support for Direct Preference Optimization (DPO) training
via the existing HuggingFace inline provider. It introduces a new DPO
training recipe, config schema updates, dataset integration, and
end-to-end testing to support preference-based fine-tuning with TRL.

Test Plan

Added integration test:

tests/integration/post_training/test_post_training.py::TestPostTraining::test_preference_optimize

Ran tests on both CPU and CUDA environments

---------

Co-authored-by: Ubuntu <ubuntu@ip-172-31-43-83.ec2.internal>
Co-authored-by: Ashwin Bharambe <ashwin.bharambe@gmail.com>
2025-07-30 23:33:36 -07:00

1.5 KiB

inline::huggingface

Description

HuggingFace-based post-training provider for fine-tuning models using the HuggingFace ecosystem.

Configuration

Field Type Required Default Description
device <class 'str'> No cuda
distributed_backend Literal['fsdp', 'deepspeed' No
checkpoint_format Literal['full_state', 'huggingface' No huggingface
chat_template <class 'str'> No < user
{input}
< assistant >
{output}
model_specific_config <class 'dict'> No {'trust_remote_code': True, 'attn_implementation': 'sdpa'}
max_seq_length <class 'int'> No 2048
gradient_checkpointing <class 'bool'> No False
save_total_limit <class 'int'> No 3
logging_steps <class 'int'> No 10
warmup_ratio <class 'float'> No 0.1
weight_decay <class 'float'> No 0.01
dataloader_num_workers <class 'int'> No 4
dataloader_pin_memory <class 'bool'> No True
dpo_beta <class 'float'> No 0.1
use_reference_model <class 'bool'> No True
dpo_loss_type Literal['sigmoid', 'hinge', 'ipo', 'kto_pair' No sigmoid
dpo_output_dir <class 'str'> No ./checkpoints/dpo

Sample Configuration

checkpoint_format: huggingface
distributed_backend: null
device: cpu