diff options
| -rw-r--r-- | Dockerfile | 2 | ||||
| -rw-r--r-- | makima/src/bin/makima.rs | 1 | ||||
| -rw-r--r-- | makima/src/daemon/cli/server.rs | 4 | ||||
| -rw-r--r-- | makima/src/server/state.rs | 12 |
4 files changed, 16 insertions, 3 deletions
@@ -18,7 +18,7 @@ RUN chmod +x /app/download-models.sh ARG MODEL_BASE_URL ENV MODEL_BASE_URL=${MODEL_BASE_URL} -ENV MODELS_DIR=/models +ENV MODELS_DIR=/app/models ENV QWEN3_TTS_DIR=/app/models/qwen3-tts RUN /app/download-models.sh echo "Models downloaded" diff --git a/makima/src/bin/makima.rs b/makima/src/bin/makima.rs index 8e83565..c637c36 100644 --- a/makima/src/bin/makima.rs +++ b/makima/src/bin/makima.rs @@ -49,6 +49,7 @@ async fn run_server( &args.parakeet_model_dir, &args.parakeet_eou_dir, &args.sortformer_model_path, + &args.qwen3_tts_dir, ); // Connect to database if URL provided diff --git a/makima/src/daemon/cli/server.rs b/makima/src/daemon/cli/server.rs index 371a912..81dafc9 100644 --- a/makima/src/daemon/cli/server.rs +++ b/makima/src/daemon/cli/server.rs @@ -33,6 +33,10 @@ pub struct ServerArgs { )] pub sortformer_model_path: String, + /// Path to Qwen3-TTS model directory + #[arg(long, env = "QWEN3_TTS_DIR", default_value = "models/qwen3-tts")] + pub qwen3_tts_dir: String, + /// PostgreSQL connection URI #[arg(long, env = "POSTGRES_CONNECTION_URI")] pub database_url: Option<String>, diff --git a/makima/src/server/state.rs b/makima/src/server/state.rs index 041b101..4650a57 100644 --- a/makima/src/server/state.rs +++ b/makima/src/server/state.rs @@ -557,6 +557,7 @@ pub struct ModelConfig { pub parakeet_model_dir: String, pub parakeet_eou_dir: String, pub sortformer_model_path: String, + pub qwen3_tts_dir: String, } /// Lazily-loaded ML models. @@ -615,10 +616,12 @@ impl AppState { /// * `parakeet_model_dir` - Path to the Parakeet TDT model directory /// * `parakeet_eou_dir` - Path to the Parakeet EOU model directory /// * `sortformer_model_path` - Path to the Sortformer diarization model file + /// * `qwen3_tts_dir` - Path to the Qwen3-TTS model directory pub fn new( parakeet_model_dir: &str, parakeet_eou_dir: &str, sortformer_model_path: &str, + qwen3_tts_dir: &str, ) -> Self { // Create broadcast channels with buffer for 256 messages let (file_updates, _) = broadcast::channel(256); @@ -662,6 +665,7 @@ impl AppState { parakeet_model_dir: parakeet_model_dir.to_string(), parakeet_eou_dir: parakeet_eou_dir.to_string(), sortformer_model_path: sortformer_model_path.to_string(), + qwen3_tts_dir: qwen3_tts_dir.to_string(), }), ml_models: OnceCell::new(), db_pool: None, @@ -687,11 +691,15 @@ impl AppState { /// The TTS engine is loaded on first Speak connection using the Qwen3 backend. /// Returns a reference to the engine, or an error if loading fails. pub async fn get_tts_engine(&self) -> Result<&dyn TtsEngine, Box<dyn std::error::Error + Send + Sync>> { + let tts_dir = self.model_config.as_ref().map(|c| c.qwen3_tts_dir.as_str()); self.tts_engine.get_or_try_init(|| async { - tracing::info!("Lazy-loading TTS engine (Qwen3) on first Speak connection..."); + tracing::info!( + model_dir = ?tts_dir, + "Lazy-loading TTS engine (Qwen3) on first Speak connection..." + ); let engine = crate::tts::TtsEngineFactory::create( crate::tts::TtsBackend::Qwen3, - None, // Use default model directory + tts_dir, ).map_err(|e| -> Box<dyn std::error::Error + Send + Sync> { Box::new(e) })?; |
