pub struct UnifiedModelLoader {
pub config_generator: ConfigGenerator,
/* private fields */
}Expand description
Unified model loader that handles downloading, config generation, and model loading
Fields§
§config_generator: ConfigGeneratorImplementations§
Source§impl UnifiedModelLoader
impl UnifiedModelLoader
Sourcepub fn load_model(&self, model_id: &str) -> Result<QwenModel>
pub fn load_model(&self, model_id: &str) -> Result<QwenModel>
Load a model by HuggingFace model ID with automatic downloading and config generation
This replaces the pattern of hardcoded paths in config files.
§Example
use candle_coreml::UnifiedModelLoader;
let loader = UnifiedModelLoader::new()?;
let _model = loader.load_model("mazhewitt/qwen-typo-fixer-coreml")?;Sourcepub fn load_model_from_config(&self, config: &ModelConfig) -> Result<QwenModel>
pub fn load_model_from_config(&self, config: &ModelConfig) -> Result<QwenModel>
Load a model from a pre-existing config (useful for advanced use cases)
Sourcepub fn ensure_model_available(&self, model_id: &str) -> Result<PathBuf>
pub fn ensure_model_available(&self, model_id: &str) -> Result<PathBuf>
Ensure model is downloaded and return the path (useful for external tools)
Sourcepub fn generate_config(&self, model_id: &str) -> Result<ModelConfig>
pub fn generate_config(&self, model_id: &str) -> Result<ModelConfig>
Generate or update config for a model without loading it
Sourcepub fn list_cached_models(&self) -> Result<Vec<CachedModelInfo>>
pub fn list_cached_models(&self) -> Result<Vec<CachedModelInfo>>
List all cached models and their status
Auto Trait Implementations§
impl Freeze for UnifiedModelLoader
impl RefUnwindSafe for UnifiedModelLoader
impl Send for UnifiedModelLoader
impl Sync for UnifiedModelLoader
impl Unpin for UnifiedModelLoader
impl UnwindSafe for UnifiedModelLoader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more