1pub mod builder;
2pub mod cache;
3pub mod config;
4pub mod conversion;
5pub mod download;
6pub mod model;
7pub mod pipeline;
8pub mod qwen;
9pub mod state;
10pub mod unified_model_loader;
11pub mod utils;
12
13pub mod cache_manager {
15 pub use crate::cache::*;
16}
17pub mod clean_git_lfs_downloader {
18 pub use crate::download::git_lfs::*;
19}
20pub mod config_generator {
21 pub use crate::config::generator::*;
22}
23pub mod model_config {
24 pub use crate::config::model::*;
25}
26pub mod model_downloader {
27 pub use crate::download::unified::*;
28}
29
30pub use builder::CoreMLModelBuilder;
31pub use cache::CacheManager;
32pub use config::{
33 ComponentConfig, Config, ConfigGenerator, ModelConfig, NamingConfig, ShapeConfig, TensorConfig,
34};
35pub use model::CoreMLModel;
36pub use qwen::{ModelNamingConfig, QwenConfig, QwenModel};
37pub use state::CoreMLState;
38pub use unified_model_loader::{CachedModelInfo, UnifiedModelLoader};
39
40pub use download::{
42 download_model, download_model_to, ensure_model_downloaded, get_cached_model_path,
43};
44
45pub use download::{download_hf_model_clean, verify_download_completeness, CleanDownloadConfig};
47
48pub use utils::{mask, multi_component, sampling};
50
51use std::path::PathBuf;
52
53pub fn get_local_or_remote_file(
56 filename: &str,
57 api: &hf_hub::api::sync::ApiRepo,
58) -> anyhow::Result<PathBuf> {
59 let local_filename = PathBuf::from(filename);
60 if local_filename.exists() {
61 Ok(local_filename)
62 } else {
63 Ok(api.get(filename)?)
64 }
65}