Skip to content

Conversation

yaozengwei
Copy link
Collaborator

@yaozengwei yaozengwei commented Jul 29, 2025

Summary by CodeRabbit

  • New Features

    • Added support for a new Zipvoice offline text-to-speech (TTS) model, including configuration options and metadata.
    • Introduced the ability to configure, validate, and use Zipvoice models for TTS synthesis, with options for model paths, synthesis parameters, and prompt audio conditioning.
    • Enhanced TTS capabilities with diffusion-based synthesis and advanced configuration parameters for audio generation.
  • Documentation

    • Updated configuration and metadata documentation to include Zipvoice model parameters and options.

Copy link

coderabbitai bot commented Jul 29, 2025

Walkthrough

This change introduces support for a new "zipvoice" offline text-to-speech (TTS) model in the sherpa-onnx codebase. It adds configuration structures, validation, and stringification for the zipvoice model, and implements the model's inference pipeline, metadata, and integration into the existing TTS model selection logic.

Changes

Cohort / File(s) Change Summary
Zipvoice Model Implementation
sherpa-onnx/csrc/offline-tts-zipvoice-model.h, sherpa-onnx/csrc/offline-tts-zipvoice-model.cc
Introduces the OfflineTtsZipvoiceModel class, encapsulating ONNX-based zipvoice TTS model loading, metadata extraction, and inference logic, including a diffusion process for speech synthesis.
Zipvoice Model Metadata
sherpa-onnx/csrc/offline-tts-zipvoice-model-meta-data.h
Adds a struct for storing zipvoice model metadata such as version, feature dimensions, sample rate, FFT parameters, and mel bins.
Zipvoice Model Configuration
sherpa-onnx/csrc/offline-tts-zipvoice-model-config.h, sherpa-onnx/csrc/offline-tts-zipvoice-model-config.cc
Defines and implements the configuration struct for the zipvoice model, with registration, validation, and string conversion methods.
Zipvoice TTS Implementation
sherpa-onnx/csrc/offline-tts-zipvoice-impl.h
Implements the OfflineTtsZipvoiceImpl class, integrating text tokenization, prompt handling, model inference, and vocoder synthesis for the zipvoice TTS pipeline.
TTS Model Config Integration
sherpa-onnx/csrc/offline-tts-model-config.h, sherpa-onnx/csrc/offline-tts-model-config.cc
Extends the central TTS model configuration to include zipvoice support, updating member variables, constructor, registration, validation, and stringification logic.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant OfflineTtsZipvoiceImpl
    participant ZipvoiceModel
    participant Vocoder

    User->>OfflineTtsZipvoiceImpl: Generate(text, prompt_text, prompt_samples, ...)
    OfflineTtsZipvoiceImpl->>OfflineTtsZipvoiceImpl: Tokenize text and prompt_text
    OfflineTtsZipvoiceImpl->>OfflineTtsZipvoiceImpl: Compute mel features from prompt_samples
    OfflineTtsZipvoiceImpl->>ZipvoiceModel: Run(tokens, prompt_tokens, prompt_features, speed, num_step)
    ZipvoiceModel-->>OfflineTtsZipvoiceImpl: Synthesized mel spectrogram
    OfflineTtsZipvoiceImpl->>Vocoder: Synthesize waveform from mel spectrogram
    Vocoder-->>OfflineTtsZipvoiceImpl: Audio samples
    OfflineTtsZipvoiceImpl-->>User: GeneratedAudio (samples, sample_rate)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~40 minutes

Poem

In the warren where code bunnies dwell,
A zipvoice TTS now casts its spell—
With configs and models, so neatly arrayed,
Mel spectrograms hop, no detail delayed.
From prompt to waveform, the journey is clear,
New voices emerge—let’s lend them an ear!
🐇🎤✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🧹 Nitpick comments (2)
sherpa-onnx/csrc/offline-tts-zipvoice-impl.h (1)

88-95: Implement frontend initialization methods.

The frontend initialization methods are marked as TODO but the frontend is being used in the Generate method. These need to be implemented.

Would you like me to help implement the frontend initialization methods or create an issue to track this task?

sherpa-onnx/csrc/offline-tts-zipvoice-model.cc (1)

103-105: Consider using a fixed seed for reproducibility.

Using std::random_device{}() makes the model non-deterministic. For reproducible results, consider allowing a seed to be configured.

Consider adding a seed parameter to the configuration or using a fixed seed:

-std::default_random_engine rng(std::random_device{}());
+// Use a fixed seed for reproducibility, or make it configurable
+std::default_random_engine rng(config_.zipvoice.random_seed);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ee9bd25 and 4562c12.

📒 Files selected for processing (8)
  • sherpa-onnx/csrc/offline-tts-model-config.cc (3 hunks)
  • sherpa-onnx/csrc/offline-tts-model-config.h (3 hunks)
  • sherpa-onnx/csrc/offline-tts-zipvoice-impl.h (1 hunks)
  • sherpa-onnx/csrc/offline-tts-zipvoice-model-config.cc (1 hunks)
  • sherpa-onnx/csrc/offline-tts-zipvoice-model-config.h (1 hunks)
  • sherpa-onnx/csrc/offline-tts-zipvoice-model-meta-data.h (1 hunks)
  • sherpa-onnx/csrc/offline-tts-zipvoice-model.cc (1 hunks)
  • sherpa-onnx/csrc/offline-tts-zipvoice-model.h (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (3)
sherpa-onnx/csrc/offline-tts-zipvoice-model-meta-data.h (2)
sherpa-onnx/csrc/offline-tts-zipvoice-model.h (1)
  • sherpa_onnx (15-40)
sherpa-onnx/csrc/offline-tts-zipvoice-impl.h (1)
  • sherpa_onnx (24-268)
sherpa-onnx/csrc/offline-tts-zipvoice-model-config.cc (1)
sherpa-onnx/csrc/offline-tts-model-config.cc (6)
  • Register (11-25)
  • Register (11-11)
  • Validate (27-46)
  • Validate (27-27)
  • ToString (48-61)
  • ToString (48-48)
sherpa-onnx/csrc/offline-tts-zipvoice-model-config.h (3)
sherpa-onnx/csrc/offline-tts-zipvoice-model-meta-data.h (1)
  • sherpa_onnx (11-26)
sherpa-onnx/csrc/offline-tts-zipvoice-model.h (1)
  • sherpa_onnx (15-40)
sherpa-onnx/csrc/offline-tts-model-config.h (1)
  • sherpa_onnx (16-50)
🔇 Additional comments (21)
sherpa-onnx/csrc/offline-tts-model-config.cc (3)

15-15: LGTM! Consistent integration pattern.

The zipvoice configuration registration follows the same pattern as existing TTS models and is properly placed in the registration sequence.


41-43: LGTM! Proper validation sequence.

The zipvoice validation is correctly placed before the kokoro fallback and uses the appropriate key field (flow_matching_model) to determine model selection.


55-55: LGTM! Consistent string representation.

The zipvoice configuration is properly included in the string output following the established pattern.

sherpa-onnx/csrc/offline-tts-model-config.h (3)

13-13: LGTM! Proper header inclusion.

The zipvoice model config header is correctly included alongside other TTS model configuration headers.


22-22: LGTM! Consistent struct organization.

The zipvoice configuration member is properly added following the established pattern of other TTS model configurations.


33-33: LGTM! Consistent constructor implementation.

The zipvoice parameter and initialization are properly integrated into the constructor following the established pattern of other TTS model configurations.

Also applies to: 39-39

sherpa-onnx/csrc/offline-tts-zipvoice-model-meta-data.h (4)

5-10: LGTM! Proper header structure.

Header guards follow project conventions and necessary standard headers are correctly included.


13-15: LGTM! Helpful documentation reference.

The comment provides useful guidance for users to understand field meanings by referencing the original Python implementation.


16-24: LGTM! Well-designed metadata structure.

The struct fields represent standard audio processing parameters with mathematically consistent default values (e.g., hop_length = n_fft/4, window_length = n_fft, num_mels = feat_dim).


26-28: LGTM! Proper file structure closure.

Namespace and header guard are correctly closed following project conventions.

sherpa-onnx/csrc/offline-tts-zipvoice-model-config.h (5)

5-11: LGTM! Proper header structure.

Header guards follow project conventions and necessary headers are correctly included for the configuration struct.


15-17: LGTM! Clear model path definitions.

The three model path members (text_model, flow_matching_model, vocoder) represent a typical TTS pipeline with clear, descriptive naming.


19-24: LGTM! Well-chosen synthesis parameters.

The synthesis parameters have reasonable default values that represent neutral/standard settings for TTS synthesis (e.g., speed=1.0, guidance_scale=1.0, num_step=16 for diffusion).


26-26: LGTM! Well-structured constructors.

Both default and parameterized constructors are properly implemented. Parameter defaults match member defaults, and initialization order follows declaration order.

Also applies to: 28-45


47-50: LGTM! Consistent method interface.

The method declarations follow the established pattern used by other TTS model configuration classes, ensuring API consistency.

sherpa-onnx/csrc/offline-tts-zipvoice-model-config.cc (4)

5-10: LGTM! Appropriate header inclusions.

Headers are correctly included for file validation and logging functionality. The self-include follows project conventions.


14-33: LGTM! Comprehensive parameter registration.

All configuration parameters are properly registered with clear, informative help text. The "zipvoice-" prefix maintains consistency and avoids naming conflicts.


35-99: LGTM! Comprehensive validation implementation.

The validation covers all required aspects:

  • File existence checks for all model files with clear error messages
  • Appropriate numeric bounds validation (positive values where required, non-negative for t_shift)
  • Descriptive error logging with parameter values

101-116: LGTM! Complete string representation.

The ToString method properly serializes all configuration parameters in a readable format consistent with other model configurations in the project.

sherpa-onnx/csrc/offline-tts-zipvoice-model.h (1)

1-42: LGTM!

The header file is well-structured with proper include guards, follows the pimpl idiom for ABI stability, and has appropriate method signatures.

sherpa-onnx/csrc/offline-tts-zipvoice-model.cc (1)

12-14: Ignore the API-level 9 guard; it’s correct
AAssetManager and its JNI bindings were introduced in Android API 9 and the same #if __ANDROID_API__ >= 9 guard is applied consistently across every Android‐specific source file. No changes are needed.

Likely an incorrect or invalid review comment.

#include <cmath>
#include <memory>
#include <string>
#include <strstream>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Replace deprecated header with modern alternative.

The <strstream> header is deprecated. Use <sstream> instead.

-#include <strstream>
+#include <sstream>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
#include <strstream>
-#include <strstream>
+#include <sstream>
🤖 Prompt for AI Agents
In sherpa-onnx/csrc/offline-tts-zipvoice-impl.h at line 10, replace the
deprecated #include <strstream> directive with #include <sstream> to use the
modern, supported header for string stream operations.

Comment on lines +28 to +33
explicit OfflineTtsZipvoiceImpl(const OfflineTtsConfig &config)
: config_(config),
model_(std::make_unique<OfflineTtsZipvoiceModel>(config.model)),
vocoder_(Vocoder::Create(config.model)) {
InitFrontend();

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix missing closing brace in constructor.

The constructor is missing a closing brace.

 explicit OfflineTtsZipvoiceImpl(const OfflineTtsConfig &config)
     : config_(config),
       model_(std::make_unique<OfflineTtsZipvoiceModel>(config.model)),
       vocoder_(Vocoder::Create(config.model)) {
   InitFrontend();
-
+ }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
explicit OfflineTtsZipvoiceImpl(const OfflineTtsConfig &config)
: config_(config),
model_(std::make_unique<OfflineTtsZipvoiceModel>(config.model)),
vocoder_(Vocoder::Create(config.model)) {
InitFrontend();
explicit OfflineTtsZipvoiceImpl(const OfflineTtsConfig &config)
: config_(config),
model_(std::make_unique<OfflineTtsZipvoiceModel>(config.model)),
vocoder_(Vocoder::Create(config.model)) {
InitFrontend();
}
🤖 Prompt for AI Agents
In sherpa-onnx/csrc/offline-tts-zipvoice-impl.h around lines 28 to 33, the
constructor OfflineTtsZipvoiceImpl is missing its closing brace. Add the missing
closing brace at the end of the constructor definition to properly close the
function body.

Comment on lines +51 to +77
std::vector<TokenIDs> text_token_ids =
frontend_->ConvertTextToTokenIds(text);

std::vector<TokenIDs> prompt_token_ids =
frontend_->ConvertTextToTokenIds(prompt_text);

if (text_token_ids.empty() ||
(text_token_ids.size() == 1 && text_token_ids[0].tokens.empty())) {
#if __OHOS__
SHERPA_ONNX_LOGE("Failed to convert '%{public}s' to token IDs", text.c_str());
#else
SHERPA_ONNX_LOGE("Failed to convert '%s' to token IDs", text.c_str());
#endif
return {};
}

if (prompt_token_ids.empty() ||
(prompt_token_ids.size() == 1 && prompt_token_ids[0].tokens.empty())) {
#if __OHOS__
SHERPA_ONNX_LOGE("Failed to convert prompt text '%{public}s' to token IDs",
prompt_text.c_str());
#else
SHERPA_ONNX_LOGE("Failed to convert prompt text '%s' to token IDs",
prompt_text.c_str());
#endif
return {};
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Add missing frontend_ member variable.

The code uses frontend_ member variable in multiple places but it's not declared. Based on the TODO comment at line 265, this member needs to be added.

Add the missing member declaration:

 private:
   OfflineTtsConfig config_;
   std::unique_ptr<OfflineTtsZipvoiceModel> model_;
   std::unique_ptr<Vocoder> vocoder_;
-  // TODO: add frontend_ here
+  std::unique_ptr<OfflineTtsFrontend> frontend_;

Also applies to: 265-265

🤖 Prompt for AI Agents
In sherpa-onnx/csrc/offline-tts-zipvoice-impl.h around lines 51 to 77 and line
265, the member variable frontend_ is used but not declared. To fix this, add a
declaration for the frontend_ member variable in the class definition, ensuring
it matches the expected type for the frontend object used in
ConvertTextToTokenIds calls. This will resolve the missing member error and
align with the TODO comment at line 265.

Comment on lines +219 to +221
prompt_features_tensor = Ort::Value::CreateTensor(
memory_info, prompt_features_flat.data(), prompt_features_flat.size(),
shape.data(), shape.size());
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix undefined variable usage.

The variable prompt_features_tensor is used without being declared.

 std::array<int64_t, 3> shape = {1, num_frames, mel_dim};
-prompt_features_tensor = Ort::Value::CreateTensor(
+Ort::Value prompt_features_tensor = Ort::Value::CreateTensor(
     memory_info, prompt_features_flat.data(), prompt_features_flat.size(),
     shape.data(), shape.size());
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
prompt_features_tensor = Ort::Value::CreateTensor(
memory_info, prompt_features_flat.data(), prompt_features_flat.size(),
shape.data(), shape.size());
std::array<int64_t, 3> shape = {1, num_frames, mel_dim};
Ort::Value prompt_features_tensor = Ort::Value::CreateTensor(
memory_info, prompt_features_flat.data(), prompt_features_flat.size(),
shape.data(), shape.size());
🤖 Prompt for AI Agents
In sherpa-onnx/csrc/offline-tts-zipvoice-impl.h around lines 219 to 221, the
variable prompt_features_tensor is used without declaration. Declare
prompt_features_tensor with the appropriate type, likely Ort::Value, before
assigning it the result of Ort::Value::CreateTensor to fix the undefined
variable error.

Comment on lines +62 to +69
std::vector<int64_t> tokens_shape =
tokens_shape.GetTensorTypeAndShapeInfo().GetShape();
int64_t batch_size = tokens_shape[0];
if (batch_size != 1) {
SHERPA_ONNX_LOGE("Support only batch_size == 1. Given: %d",
static_cast<int32_t>(batch_size);
exit(-1);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix variable naming and syntax errors.

There are two issues:

  1. Line 63: tokens_shape is incorrectly reused as the object to call method on
  2. Line 67: Missing closing parenthesis
 std::vector<int64_t> tokens_shape =
-    tokens_shape.GetTensorTypeAndShapeInfo().GetShape();
+    tokens.GetTensorTypeAndShapeInfo().GetShape();
 int64_t batch_size = tokens_shape[0];
 if (batch_size != 1) {
   SHERPA_ONNX_LOGE("Support only batch_size == 1. Given: %d",
-                   static_cast<int32_t>(batch_size);
+                   static_cast<int32_t>(batch_size));
   exit(-1);
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
std::vector<int64_t> tokens_shape =
tokens_shape.GetTensorTypeAndShapeInfo().GetShape();
int64_t batch_size = tokens_shape[0];
if (batch_size != 1) {
SHERPA_ONNX_LOGE("Support only batch_size == 1. Given: %d",
static_cast<int32_t>(batch_size);
exit(-1);
}
std::vector<int64_t> tokens_shape =
tokens.GetTensorTypeAndShapeInfo().GetShape();
int64_t batch_size = tokens_shape[0];
if (batch_size != 1) {
SHERPA_ONNX_LOGE("Support only batch_size == 1. Given: %d",
static_cast<int32_t>(batch_size));
exit(-1);
}
🤖 Prompt for AI Agents
In sherpa-onnx/csrc/offline-tts-zipvoice-model.cc around lines 62 to 69, the
variable tokens_shape is reused incorrectly to call
GetTensorTypeAndShapeInfo().GetShape(), which causes a naming conflict. Rename
the initial variable holding the tensor info to avoid overwriting tokens_shape.
Also, fix the syntax error on line 67 by adding the missing closing parenthesis
in the SHERPA_ONNX_LOGE call. These changes will correct the variable misuse and
syntax error.

Comment on lines +272 to +307
OfflineTtsMatchaModel::OfflineTtsMatchaModel(
const OfflineTtsModelConfig &config)
: impl_(std::make_unique<Impl>(config)) {}

template <typename Manager>
OfflineTtsMatchaModel::OfflineTtsMatchaModel(
Manager *mgr, const OfflineTtsModelConfig &config)
: impl_(std::make_unique<Impl>(mgr, config)) {}

OfflineTtsMatchaModel::~OfflineTtsMatchaModel() = default;

const OfflineTtsZipvoiceModelMetaData &OfflineTtsMatchaModel::GetMetaData()
const {
return impl_->GetMetaData();
}

Ort::Value OfflineTtsMatchaModel::Run(Ort::Value tokens,
Ort::Value prompt_tokens,
Ort::Value prompt_features,
float speed /*= 1.0*/,
int num_step /*= 16*/) const {
return impl_->Run(std::move(tokens),
std::move(prompt_tokens),
std::move(prompt_features),
speed, num_step);
}

#if __ANDROID_API__ >= 9
template OfflineTtsMatchaModel::OfflineTtsMatchaModel(
AAssetManager *mgr, const OfflineTtsModelConfig &config);
#endif

#if __OHOS__
template OfflineTtsMatchaModel::OfflineTtsMatchaModel(
NativeResourceManager *mgr, const OfflineTtsModelConfig &config);
#endif
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix class name mismatch.

The implementation uses OfflineTtsMatchaModel but the header declares OfflineTtsZipvoiceModel. This needs to be consistent.

-OfflineTtsMatchaModel::OfflineTtsMatchaModel(
+OfflineTtsZipvoiceModel::OfflineTtsZipvoiceModel(
     const OfflineTtsModelConfig &config)
     : impl_(std::make_unique<Impl>(config)) {}

 template <typename Manager>
-OfflineTtsMatchaModel::OfflineTtsMatchaModel(
+OfflineTtsZipvoiceModel::OfflineTtsZipvoiceModel(
     Manager *mgr, const OfflineTtsModelConfig &config)
     : impl_(std::make_unique<Impl>(mgr, config)) {}

-OfflineTtsMatchaModel::~OfflineTtsMatchaModel() = default;
+OfflineTtsZipvoiceModel::~OfflineTtsZipvoiceModel() = default;

-const OfflineTtsZipvoiceModelMetaData &OfflineTtsMatchaModel::GetMetaData()
+const OfflineTtsZipvoiceModelMetaData &OfflineTtsZipvoiceModel::GetMetaData()
     const {
   return impl_->GetMetaData();
 }

-Ort::Value OfflineTtsMatchaModel::Run(Ort::Value tokens,
+Ort::Value OfflineTtsZipvoiceModel::Run(Ort::Value tokens,
                                       Ort::Value prompt_tokens,
                                       Ort::Value prompt_features,
                                       float speed /*= 1.0*/,
                                       int num_step /*= 16*/) const {

 #if __ANDROID_API__ >= 9
-template OfflineTtsMatchaModel::OfflineTtsMatchaModel(
+template OfflineTtsZipvoiceModel::OfflineTtsZipvoiceModel(
     AAssetManager *mgr, const OfflineTtsModelConfig &config);
 #endif

 #if __OHOS__
-template OfflineTtsMatchaModel::OfflineTtsMatchaModel(
+template OfflineTtsZipvoiceModel::OfflineTtsZipvoiceModel(
     NativeResourceManager *mgr, const OfflineTtsModelConfig &config);
 #endif
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
OfflineTtsMatchaModel::OfflineTtsMatchaModel(
const OfflineTtsModelConfig &config)
: impl_(std::make_unique<Impl>(config)) {}
template <typename Manager>
OfflineTtsMatchaModel::OfflineTtsMatchaModel(
Manager *mgr, const OfflineTtsModelConfig &config)
: impl_(std::make_unique<Impl>(mgr, config)) {}
OfflineTtsMatchaModel::~OfflineTtsMatchaModel() = default;
const OfflineTtsZipvoiceModelMetaData &OfflineTtsMatchaModel::GetMetaData()
const {
return impl_->GetMetaData();
}
Ort::Value OfflineTtsMatchaModel::Run(Ort::Value tokens,
Ort::Value prompt_tokens,
Ort::Value prompt_features,
float speed /*= 1.0*/,
int num_step /*= 16*/) const {
return impl_->Run(std::move(tokens),
std::move(prompt_tokens),
std::move(prompt_features),
speed, num_step);
}
#if __ANDROID_API__ >= 9
template OfflineTtsMatchaModel::OfflineTtsMatchaModel(
AAssetManager *mgr, const OfflineTtsModelConfig &config);
#endif
#if __OHOS__
template OfflineTtsMatchaModel::OfflineTtsMatchaModel(
NativeResourceManager *mgr, const OfflineTtsModelConfig &config);
#endif
OfflineTtsZipvoiceModel::OfflineTtsZipvoiceModel(
const OfflineTtsModelConfig &config)
: impl_(std::make_unique<Impl>(config)) {}
template <typename Manager>
OfflineTtsZipvoiceModel::OfflineTtsZipvoiceModel(
Manager *mgr, const OfflineTtsModelConfig &config)
: impl_(std::make_unique<Impl>(mgr, config)) {}
OfflineTtsZipvoiceModel::~OfflineTtsZipvoiceModel() = default;
const OfflineTtsZipvoiceModelMetaData &OfflineTtsZipvoiceModel::GetMetaData()
const {
return impl_->GetMetaData();
}
Ort::Value OfflineTtsZipvoiceModel::Run(Ort::Value tokens,
Ort::Value prompt_tokens,
Ort::Value prompt_features,
float speed /*= 1.0*/,
int num_step /*= 16*/) const {
return impl_->Run(std::move(tokens),
std::move(prompt_tokens),
std::move(prompt_features),
speed, num_step);
}
#if __ANDROID_API__ >= 9
template OfflineTtsZipvoiceModel::OfflineTtsZipvoiceModel(
AAssetManager *mgr, const OfflineTtsModelConfig &config);
#endif
#if __OHOS__
template OfflineTtsZipvoiceModel::OfflineTtsZipvoiceModel(
NativeResourceManager *mgr, const OfflineTtsModelConfig &config);
#endif
🤖 Prompt for AI Agents
In sherpa-onnx/csrc/offline-tts-zipvoice-model.cc between lines 272 and 307, the
class name used is OfflineTtsMatchaModel, but the header declares
OfflineTtsZipvoiceModel. Rename all occurrences of OfflineTtsMatchaModel in this
file to OfflineTtsZipvoiceModel to ensure consistency with the header
declaration.

@pkufool pkufool marked this pull request as draft July 30, 2025 03:27
@csukuangfj
Copy link
Collaborator

Closing via #2487

@csukuangfj csukuangfj closed this Aug 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants