| 88 | throw std::runtime_error(std::string(option_name) + |
| 89 | " supports only native, f32, f16, bf16, and q8_0"); |
| 90 | } |
| 91 | |
| 92 | void parse_weight_type( |
| 93 | const std::unordered_map<std::string, std::string> &options, |
| 94 | const char *key, engine::assets::TensorStorageType &storage_type) { |
| 95 | const auto it = options.find(key); |
| 96 | if (it == options.end()) { |
| 97 | return; |
| 98 | } |
| 99 | storage_type = engine::assets::parse_tensor_storage_type(it->second); |
| 100 | validate_weight_storage(storage_type, key); |
| 101 | } |
| 102 | |
| 103 | void validate_session_options( |
| 104 | const std::unordered_map<std::string, std::string> &options) { |
| 105 | for (const auto &[key, value] : options) { |
| 106 | (void)value; |
| 107 | if (key.rfind("voxcpm2.", 0) != 0) { |
| 108 | continue; |
| 109 | } |
| 110 | if (key == "voxcpm2.weight_context_mb" || |
| 111 | key == "voxcpm2.text_embedding_graph_context_mb" || |
| 112 | key == "voxcpm2.lm_step_graph_context_mb" || |
| 113 | key == "voxcpm2.projection_graph_context_mb" || |
| 114 | key == "voxcpm2.local_encoder_graph_context_mb" || |
| 115 | key == "voxcpm2.dit_graph_context_mb" || |
| 116 | key == "voxcpm2.audiovae_weight_context_mb" || |
| 117 | key == "voxcpm2.audiovae_graph_context_mb" || |
| 118 | key == "voxcpm2.audiovae_encoder_graph_context_mb" || |