MCPcopy Create free account
hub / github.com/OpenPipe/ART / train_model

Function train_model

examples/benchmarking_comparison_models.py:116–140  ·  view source on GitHub ↗
(model: art.TrainableModel)

Source from the content-addressed store, hash-verified

114
115
116async def train_model(model: art.TrainableModel):
117 train_iterator = iterate_dataset(
118 training_tasks,
119 groups_per_step=4,
120 initial_step=await model.get_step(),
121 )
122
123 for batch in train_iterator:
124 groups = await art.gather_trajectory_groups(
125 art.TrajectoryGroup(
126 (rollout(model, scenario) for _ in range(6)),
127 )
128 for scenario in batch.items
129 )
130 result = await backend.train(model, groups)
131 await model.log(groups, metrics=result.metrics, step=result.step, split="train")
132
133 if batch.step % 20 == 0:
134 # Every 20 steps let's benchmark our model under training so we can
135 # see how it's doing.
136 await benchmark_model(model)
137
138 # At the end of training, let's benchmark the model again to see where it
139 # ended up.
140 await benchmark_model(model)
141
142
143async def main():

Callers 1

mainFunction · 0.85

Calls 6

iterate_datasetFunction · 0.90
benchmark_modelFunction · 0.85
get_stepMethod · 0.80
rolloutFunction · 0.70
trainMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected