MCPcopy Create free account
hub / github.com/agentscope-ai/Trinity-RFT / setUp

Method setUp

tests/trainer/trainer_test.py:1130–1162  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1128
1129class TestServeWithTrainer(RayUnittestBaseAsync):
1130 def setUp(self):
1131 if multiprocessing.get_start_method(allow_none=True) != "spawn":
1132 multiprocessing.set_start_method("spawn", force=True)
1133 checkpoint_path = get_checkpoint_path()
1134 shutil.rmtree(os.path.join(checkpoint_path, "unittest"), ignore_errors=True)
1135
1136 config = get_template_config()
1137 config.project = "unittest"
1138 config.name = f"serve_with_trainer_{datetime.now().strftime('%Y%m%d%H%M%S')}"
1139 config.checkpoint_root_dir = get_checkpoint_path()
1140 config.model.model_path = get_model_path()
1141 config.buffer.batch_size = 4
1142 config.buffer.train_batch_size = 4
1143 config.algorithm.algorithm_type = "ppo"
1144 config.algorithm.repeat_times = 1
1145 config.cluster.gpu_per_node = 2
1146 config.cluster.node_num = 1
1147 config.buffer.trainer_input.experience_buffer = ExperienceBufferConfig(
1148 name="exp_buffer",
1149 storage_type=StorageType.SQL.value,
1150 schema_type="experience",
1151 )
1152 config.buffer.explorer_input.taskset = get_unittest_dataset_config("gsm8k")
1153 config.buffer.total_steps = 3
1154 config.trainer.save_interval = 1
1155 config.synchronizer.sync_interval = 1
1156 config.synchronizer.sync_method = SyncMethod.CHECKPOINT
1157 config.explorer.rollout_model.engine_num = 2
1158 config.explorer.rollout_model.enable_openai_api = True
1159 config.explorer.rollout_model.tensor_parallel_size = 1
1160 config.explorer.service_status_check_interval = 5
1161 self.config = config
1162 self.process_list = []
1163
1164 async def test_serve_with_trainer(self): # noqa: C901
1165 trainer_config = deepcopy(self.config)

Callers

nothing calls this directly

Calls 5

get_checkpoint_pathFunction · 0.90
get_template_configFunction · 0.90
get_model_pathFunction · 0.90

Tested by

no test coverage detected