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

Method run

src/models/seed_vc/length_regulator.cpp:586–619  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

584 V1LengthRegulatorRunner(
585 engine::core::ExecutionContext & execution_context,
586 V1LengthRegulatorWeights weights,
587 int64_t input_channels,
588 int64_t channels,
589 int64_t f0_bins)
590 : execution_context_(execution_context),
591 weights_(weights),
592 input_channels_(input_channels),
593 channels_(channels),
594 f0_bins_(f0_bins) {}
595
596 ~V1LengthRegulatorRunner() {
597 release_graph();
598 }
599
600 SeedVcLengthRegulatorOutput run(const SeedVcV1LengthRegulatorInput & request) {
601 std::lock_guard<std::mutex> lock(mutex_);
602 if (request.batch <= 0 || request.tokens <= 0) {
603 throw std::runtime_error("Seed-VC V1 length regulator batch/tokens must be positive");
604 }
605 if (static_cast<int64_t>(request.content.size()) != request.batch * request.tokens * input_channels_) {
606 throw std::runtime_error("Seed-VC V1 length regulator content size mismatch");
607 }
608 if (static_cast<int64_t>(request.output_lengths.size()) != request.batch) {
609 throw std::runtime_error("Seed-VC V1 length regulator length count mismatch");
610 }
611 if (request.has_f0 && request.f0_tokens <= 0) {
612 throw std::runtime_error("Seed-VC V1 length regulator f0 token count must be positive");
613 }
614 if (request.has_f0 && static_cast<int64_t>(request.f0.size()) != request.batch * request.f0_tokens) {
615 throw std::runtime_error("Seed-VC V1 length regulator f0 size mismatch");
616 }
617 const int64_t output_tokens = *std::max_element(request.output_lengths.begin(), request.output_lengths.end());
618 ensure_graph(request.batch, request.tokens, output_tokens, request.has_f0 ? request.f0_tokens : 0);
619 engine::core::write_tensor_f32(content_, request.content);
620 engine::core::write_tensor_f32(mask_, build_sequence_mask(request.output_lengths, output_tokens, channels_));
621 if (request.has_f0) {
622 engine::core::write_tensor_i32(f0_ids_, f0_to_coarse_ids(request.f0, f0_bins_));

Callers

nothing calls this directly

Calls 10

build_sequence_maskFunction · 0.85
write_tensor_i32Function · 0.85
f0_to_coarse_idsFunction · 0.85
compute_backend_graphFunction · 0.85
read_tensor_f32Function · 0.85
write_tensor_f32Function · 0.50
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
backendMethod · 0.45

Tested by

no test coverage detected