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

Method run

src/models/chatterbox/s3gen_flow.cpp:1565–1610  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1563 }
1564 }
1565
1566 S3FlowDecoderOutputs run(
1567 const std::vector<float> & x,
1568 const std::vector<float> & mask,
1569 const std::vector<float> & t,
1570 S3FlowDecoderRunTiming * timing = nullptr) {
1571 constexpr int64_t mel_channels = 80;
1572 constexpr int64_t time_dim = 320;
1573 if (timing != nullptr) {
1574 ++timing->calls;
1575 }
1576 auto started = Clock::now();
1577 auto time_emb_values = decoder_sinusoidal_pos_emb(t, batch_, time_dim);
1578 if (timing != nullptr) {
1579 timing->time_embedding_ms += engine::debug::elapsed_ms(started);
1580 }
1581 const int64_t valid_frames = valid_frames_from_mask(mask, batch_, active_frames_);
1582 started = Clock::now();
1583 engine::core::write_tensor_f32(x_in_, x);
1584 ensure_attention_mask(valid_frames);
1585 if (timing != nullptr) {
1586 timing->time_write_ms += engine::debug::elapsed_ms(started);
1587 }
1588 started = Clock::now();
1589 engine::core::write_tensor_f32(time_in_, time_emb_values);
1590 if (timing != nullptr) {
1591 timing->input_write_ms += engine::debug::elapsed_ms(started);
1592 }
1593 started = Clock::now();
1594 const ggml_status status = engine::core::compute_graph(*execution_context_, graph_, cpu_plan_);
1595 if (status != GGML_STATUS_SUCCESS) {
1596 throw std::runtime_error("ggml_backend_graph_compute failed for S3 flow decoder");
1597 }
1598 if (timing != nullptr) {
1599 timing->graph_compute_ms += engine::debug::elapsed_ms(started);
1600 }
1601 S3FlowDecoderOutputs outputs;
1602 started = Clock::now();
1603 outputs.mel = engine::core::read_tensor_f32(output_tensor_.tensor);
1604 if (timing != nullptr) {
1605 timing->output_read_ms += engine::debug::elapsed_ms(started);
1606 }
1607 outputs.channels = mel_channels;
1608 outputs.frames = active_frames_;
1609 outputs.storage_frames = active_frames_;
1610 return outputs;
1611 }
1612
1613private:

Callers

nothing calls this directly

Calls 6

valid_frames_from_maskFunction · 0.85
read_tensor_f32Function · 0.85
elapsed_msFunction · 0.50
write_tensor_f32Function · 0.50
compute_graphFunction · 0.50

Tested by

no test coverage detected