candle_coreml/lib.rs
1pub mod model;
2
3pub use model::{CoreMLModel, CoreMLModelBuilder, Config};
4
5use std::path::PathBuf;
6
7/// Helper function to get a file locally first, then download from HuggingFace Hub if needed.
8/// Follows the same pattern as quantized-t5 example.
9pub fn get_local_or_remote_file(filename: &str, api: &hf_hub::api::sync::ApiRepo) -> anyhow::Result<PathBuf> {
10 let local_filename = PathBuf::from(filename);
11 if local_filename.exists() {
12 Ok(local_filename)
13 } else {
14 Ok(api.get(filename)?)
15 }
16}