start worker process
()
| 1252 | |
| 1253 | @paddle.no_grad() |
| 1254 | def run_worker_proc() -> None: |
| 1255 | """ |
| 1256 | start worker process |
| 1257 | """ |
| 1258 | # Get args form Engine |
| 1259 | args = parse_args() |
| 1260 | |
| 1261 | ranks, local_rank = init_distributed_environment() |
| 1262 | |
| 1263 | # Get fd_config |
| 1264 | fd_config = initialize_fd_config(args, ranks, local_rank) |
| 1265 | |
| 1266 | # Create worker process |
| 1267 | if current_platform.is_iluvatar(): |
| 1268 | from fastdeploy.worker.iluvatar_worker import IluvatarPaddleDisWorkerProc |
| 1269 | |
| 1270 | worker_proc = IluvatarPaddleDisWorkerProc(fd_config, ranks, local_rank) |
| 1271 | else: |
| 1272 | worker_proc = PaddleDisWorkerProc(fd_config, ranks, local_rank) |
| 1273 | worker_proc.init_control() |
| 1274 | |
| 1275 | # Initialize device and create model runner |
| 1276 | worker_proc.init_device() |
| 1277 | |
| 1278 | # Load model |
| 1279 | worker_proc.load_model() |
| 1280 | # Initialize KV Cache |
| 1281 | worker_proc.initialize_kv_cache() |
| 1282 | |
| 1283 | # Trigger CUDAGraph capture |
| 1284 | worker_proc.graph_optimize_and_warm_up_model() |
| 1285 | |
| 1286 | # Initialize health status |
| 1287 | worker_proc.init_health_status() |
| 1288 | |
| 1289 | worker_proc.start_task_queue_service() |
| 1290 | |
| 1291 | # Start event loop |
| 1292 | worker_proc.event_loop_normal() |
| 1293 | |
| 1294 | |
| 1295 | if __name__ == "__main__": |
no test coverage detected