Merge pull request #33 from tuna2134/coreml

Support coreml
This commit is contained in:
コマリン親衛隊
2024-09-12 20:40:45 +09:00
committed by GitHub
4 changed files with 7 additions and 1 deletions

View File

@@ -14,6 +14,7 @@ serde = { version = "1.0.210", features = ["derive"] }
tokio = { version = "1.40.0", features = ["full"] }
[features]
coreml = ["sbv2_core/coreml"]
cuda = ["sbv2_core/cuda"]
cuda_tf32 = ["sbv2_core/cuda_tf32"]
dynamic = ["sbv2_core/dynamic"]

View File

@@ -99,7 +99,7 @@ impl AppState {
continue;
}
};
if let Err(e) = tts_model.load_sbv2file(&entry, sbv2_bytes) {
if let Err(e) = tts_model.load_sbv2file(entry, sbv2_bytes) {
log::warn!("Error loading {entry}: {e}");
};
log::info!("Loaded: {entry}");

View File

@@ -31,3 +31,4 @@ cuda_tf32 = []
dynamic = ["ort/load-dynamic"]
directml = ["ort/directml"]
tensorrt = ["ort/tensorrt"]
coreml = ["ort/coreml"]

View File

@@ -35,6 +35,10 @@ pub fn load_model<P: AsRef<[u8]>>(model_file: P, bert: bool) -> Result<Session>
{
exp.push(ort::DirectMLExecutionProvider::default().build());
}
#[cfg(feature = "coreml")]
{
exp.push(ort::CoreMLExecutionProvider::default().build());
}
exp.push(ort::CPUExecutionProvider::default().build());
Ok(Session::builder()?
.with_execution_providers(exp)?