| 156 | } |
| 157 | |
| 158 | int64_t max_generation_steps(const VibeVoicePreparedPrompt & prompt, const VibeVoiceGenerationOptions & options, const VibeVoiceDecoderConfig & config) { |
| 159 | if (prompt.steps <= 0 || config.max_position_embeddings <= prompt.steps) { |
| 160 | throw std::runtime_error("VibeVoice generation prompt exceeds decoder position capacity"); |
| 161 | } |
| 162 | int64_t by_length = config.max_position_embeddings - prompt.steps; |
| 163 | if (options.max_tokens > 0) { |
| 164 | by_length = std::min(by_length, options.max_tokens); |
| 165 | } |
| 166 | const int64_t by_ratio = static_cast<int64_t>(options.max_length_times * static_cast<float>(prompt.steps)); |
| 167 | const int64_t steps = std::min(by_length, by_ratio); |
| 168 | if (steps <= 0) { |
| 169 | throw std::runtime_error("VibeVoice generation max steps must be positive"); |
| 170 | } |
| 171 | return steps; |
| 172 | } |
| 173 | |
| 174 | std::vector<float> load_noise_file(const std::string & path, const char * label) { |
| 175 | if (path.empty()) { |
no test coverage detected