dynamic home dir & model donwload script

This commit is contained in:
KingBright
2026-01-05 15:21:15 +08:00
parent 26fccaa0f6
commit 4e35866a59
15 changed files with 378 additions and 56 deletions
+3 -2
View File
@@ -8,7 +8,8 @@ use anyhow::Result;
fn rmbg2_0_generate() -> Result<()> {
// test with cuda: RUST_BACKTRACE=1 cargo test -F cuda rmbg2_0_generate -r -- --nocapture
let model_path = "/home/jhq/huggingface_model/AI-ModelScope/RMBG-2.0/";
let save_dir = aha::utils::get_default_save_dir().ok_or(anyhow::anyhow!("Failed to get save dir"))?;
let model_path = format!("{}/AI-ModelScope/RMBG-2.0/", save_dir);
let message = r#"
{
@@ -31,7 +32,7 @@ fn rmbg2_0_generate() -> Result<()> {
"#;
let mes: ChatCompletionParameters = serde_json::from_str(message)?;
let i_start = Instant::now();
let model = RMBG2_0Model::init(model_path, None, None)?;
let model = RMBG2_0Model::init(&model_path, None, None)?;
let i_duration = i_start.elapsed();
println!("Time elapsed in load model is: {:?}", i_duration);