MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / validate_generation_options

Function validate_generation_options

src/models/voxcpm2/generator.cpp:66–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64 if (assets == nullptr) {
65 throw std::runtime_error("VoxCPM2 feature generator requires assets");
66 }
67 return assets;
68}
69
70void validate_generation_options(const VoxCPM2GenerationOptions &options) {
71 if (options.min_tokens < 0) {
72 throw std::runtime_error("VoxCPM2 min_tokens must be non-negative");
73 }
74 if (options.max_tokens < 0) {
75 throw std::runtime_error("VoxCPM2 max_tokens must be non-negative");
76 }
77 if (options.num_inference_steps <= 0) {
78 throw std::runtime_error(
79 "VoxCPM2 num_inference_steps must be positive");
80 }
81 if (!std::isfinite(options.guidance_scale)) {
82 throw std::runtime_error("VoxCPM2 guidance_scale must be finite");
83 }
84 if (options.stream_left_context < 0 ||
85 options.stream_left_context > kVoxCPM2MaxStreamLeftContext) {
86 throw std::runtime_error(
87 "VoxCPM2 stream_left_context must be between 0 and " +
88 std::to_string(kVoxCPM2MaxStreamLeftContext));
89 }
90 if (options.retry_badcase_max_times <= 0) {
91 throw std::runtime_error(
92 "VoxCPM2 retry_badcase_max_times must be positive");

Callers 2

generateMethod · 0.85
generate_streamingMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected