Skip to content

Commit 8ebdff4

Browse files
committed
add unpack logic in am model download check
1 parent ff31bda commit 8ebdff4

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

crates/am/src/model.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,15 @@ impl AmModel {
5858
&self,
5959
base_dir: impl AsRef<std::path::Path>,
6060
) -> Result<bool, crate::Error> {
61+
let tar_path = base_dir.as_ref().join(format!("{}.tar", self.model_dir()));
6162
let model_path = base_dir.as_ref().join(self.model_dir());
62-
if !model_path.exists() {
63-
return Ok(false);
63+
64+
// Due to CoreML compilation issue, we can only embed tar file for now
65+
if !model_path.exists() && tar_path.exists() {
66+
let _ = self.tar_verify_and_unpack(&tar_path, &model_path);
6467
}
6568

66-
if !model_path.is_dir() {
69+
if !model_path.exists() || !model_path.is_dir() {
6770
return Ok(false);
6871
}
6972

0 commit comments

Comments
 (0)