Skip to main content

Goal

In this page, we are going to guide you through the writing of a simple custom recipe from model loading to training. The goal of this page is to let you achieve the writing of your first custom recipe and understand the syntax.

Step by step guide

1

Create a new python file

Custom recipes are written as python files. You can store it anywhere you want in your codebase. Let’s create a recipe my_custom_recipe.py
Fill it with this recipe skeleton:
my_custom_recipe.py
The decorator @recipe_main define the function main as a recipe and will allow it to run on the Adaptive Engine.The harmony client and the model to train can be retrieved from the recipe context.
2

Load models

In this recipe, we will run a PPO training with completion safety judged by gpt-4o as a scorer. We begin to spawn 3 models, the policy model, the value model and the judge model.
3

Load Dataset

4

Define a Scorer

5

Adapt the model

Full recipe

my_custom_recipe.py