summaryrefslogtreecommitdiff
path: root/candle-examples/examples
diff options
context:
space:
mode:
authorLaurent Mazare <laurent.mazare@gmail.com>2024-08-22 22:22:03 +0100
committerGitHub <noreply@github.com>2024-08-22 23:22:03 +0200
commit2ec8729d51a8561841d95b55bbe7fc4e7991eab2 (patch)
tree4634a48657213533e43d32c010f21c4f3ca11884 /candle-examples/examples
parente3c146ada665cd9ba5265a742c502a7309ca879e (diff)
downloadcandle-2ec8729d51a8561841d95b55bbe7fc4e7991eab2.tar.gz
candle-2ec8729d51a8561841d95b55bbe7fc4e7991eab2.tar.bz2
candle-2ec8729d51a8561841d95b55bbe7fc4e7991eab2.zip
Fix for parler-tts, do not add the last slice of padding tokens. (#2442)
* Fix for parler-tts, do not add the last slice of padding tokens. * Support for the mini model.
Diffstat (limited to 'candle-examples/examples')
-rw-r--r--candle-examples/examples/parler-tts/main.rs23
1 files changed, 21 insertions, 2 deletions
diff --git a/candle-examples/examples/parler-tts/main.rs b/candle-examples/examples/parler-tts/main.rs
index 4e3730e2..88e0ef8b 100644
--- a/candle-examples/examples/parler-tts/main.rs
+++ b/candle-examples/examples/parler-tts/main.rs
@@ -86,6 +86,17 @@ struct Args {
/// The output wav file.
#[arg(long, default_value = "out.wav")]
out_file: String,
+
+ #[arg(long, default_value = "large-v1")]
+ which: Which,
+}
+
+#[derive(Clone, Debug, Copy, PartialEq, Eq, clap::ValueEnum)]
+enum Which {
+ #[value(name = "large-v1")]
+ LargeV1,
+ #[value(name = "mini-v1")]
+ MiniV1,
}
fn main() -> anyhow::Result<()> {
@@ -117,7 +128,10 @@ fn main() -> anyhow::Result<()> {
let api = hf_hub::api::sync::Api::new()?;
let model_id = match args.model_id {
Some(model_id) => model_id.to_string(),
- None => "parler-tts/parler-tts-large-v1".to_string(),
+ None => match args.which {
+ Which::LargeV1 => "parler-tts/parler-tts-large-v1".to_string(),
+ Which::MiniV1 => "parler-tts/parler-tts-mini-v1".to_string(),
+ },
};
let revision = match args.revision {
Some(r) => r,
@@ -130,7 +144,12 @@ fn main() -> anyhow::Result<()> {
));
let model_files = match args.model_file {
Some(m) => vec![m.into()],
- None => candle_examples::hub_load_safetensors(&repo, "model.safetensors.index.json")?,
+ None => match args.which {
+ Which::MiniV1 => vec![repo.get("model.safetensors")?],
+ Which::LargeV1 => {
+ candle_examples::hub_load_safetensors(&repo, "model.safetensors.index.json")?
+ }
+ },
};
let config = match args.config_file {
Some(m) => m.into(),