(self)
| 1128 | |
| 1129 | class 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) |
nothing calls this directly
no test coverage detected