| 45 | }; |
| 46 | |
| 47 | int64_t require_head_dim(const VibeVoiceDecoderConfig & config) { |
| 48 | if (config.hidden_size <= 0 || config.intermediate_size <= 0) { |
| 49 | throw std::runtime_error("VibeVoice decoder hidden sizes must be positive"); |
| 50 | } |
| 51 | if (config.num_attention_heads <= 0 || config.num_key_value_heads <= 0 || config.head_dim <= 0) { |
| 52 | throw std::runtime_error("VibeVoice decoder attention dimensions must be positive"); |
| 53 | } |
| 54 | if (config.num_attention_heads % config.num_key_value_heads != 0) { |
| 55 | throw std::runtime_error("VibeVoice decoder attention heads must be divisible by key/value heads"); |
| 56 | } |
| 57 | if (config.num_attention_heads * config.head_dim != config.hidden_size) { |
| 58 | throw std::runtime_error("VibeVoice decoder hidden_size must equal attention heads times head_dim"); |
| 59 | } |
| 60 | return config.head_dim; |
| 61 | } |
| 62 | |
| 63 | core::TensorValue reshape_heads( |
| 64 | core::ModuleBuildContext & ctx, |
no outgoing calls
no test coverage detected