| 241 | } // namespace |
| 242 | |
| 243 | int main(int argc, char ** argv) { |
| 244 | try { |
| 245 | const std::filesystem::path model_path = arg_value(argc, argv, "--model", "models/Vevo2"); |
| 246 | const std::string backend_name = arg_value(argc, argv, "--backend", "cuda"); |
| 247 | const int device = int_arg(argc, argv, "--device", 0); |
| 248 | const int threads = int_arg(argc, argv, "--threads", 8); |
| 249 | const int warmup = int_arg(argc, argv, "--warmup", 0); |
| 250 | const int iterations = int_arg(argc, argv, "--iterations", 1); |
| 251 | const std::string request_sequence_json = arg_value(argc, argv, "--request-sequence-json", ""); |
| 252 | const std::string noise_file = arg_value(argc, argv, "--noise-file", ""); |
| 253 | const std::filesystem::path output_dir = arg_value(argc, argv, "--output-dir", ""); |
| 254 | const std::filesystem::path timing_path = |
| 255 | arg_value(argc, argv, "--timing-file", "/tmp/vevo2_warm_bench_timing.log"); |
| 256 | if (request_sequence_json.empty()) { |
| 257 | throw std::runtime_error("Vevo2 warmbench requires --request-sequence-json"); |
| 258 | } |
| 259 | |
| 260 | set_env_required("ENGINE_TIMING_ENABLED", "1"); |
| 261 | set_env_required("ENGINE_TIMING_FILE", timing_path.string()); |
| 262 | |
| 263 | const auto session_option_overrides = parse_session_options(argc, argv); |
| 264 | engine::runtime::ModelLoadRequest load_request; |
| 265 | load_request.model_path = model_path; |
| 266 | load_request.family_hint = "vevo2"; |
| 267 | for (const auto & [key, value] : session_option_overrides) { |
| 268 | load_request.options.insert_or_assign(key, value); |
| 269 | } |
| 270 | auto registry = engine::runtime::make_default_registry(); |
| 271 | auto model = registry.load(load_request); |
| 272 | |
| 273 | engine::runtime::SessionOptions options; |
| 274 | options.backend.type = parse_backend(backend_name); |
| 275 | options.backend.device = device; |
| 276 | options.backend.threads = threads; |
| 277 | for (const auto & [key, value] : session_option_overrides) { |
| 278 | options.options.insert_or_assign(key, value); |
| 279 | } |
| 280 | engine::runtime::TaskSpec task{engine::runtime::VoiceTaskKind::Svc, engine::runtime::RunMode::Offline}; |
| 281 | auto session_base = model->create_task_session(task, options); |
| 282 | auto * session = dynamic_cast<engine::runtime::IOfflineVoiceTaskSession *>(session_base.get()); |
| 283 | if (session == nullptr) { |
| 284 | throw std::runtime_error("loaded Vevo2 session is not an offline SVC session"); |
| 285 | } |
| 286 | session->prepare({}); |
| 287 | |
| 288 | const auto requests = parse_requests(request_sequence_json, noise_file); |
| 289 | if (requests.empty()) { |
| 290 | throw std::runtime_error("Vevo2 warmbench request sequence is empty"); |
| 291 | } |
| 292 | for (int i = 0; i < warmup; ++i) { |
| 293 | (void) session->run(requests.front()); |
| 294 | } |
| 295 | |
| 296 | if (!output_dir.empty()) { |
| 297 | std::filesystem::create_directories(output_dir); |
| 298 | } |
| 299 | |
| 300 | engine::io::json::Value::Array steps; |
nothing calls this directly
no test coverage detected