Module model_service

Module model_service 

Source
Expand description

Model management service for downloading and caching AI models from HuggingFace Hub

This service provides a unified interface for:

  • Downloading models from HuggingFace Hub using the model catalog
  • Caching models to the project’s models/ directory
  • Listing available and installed models
  • Managing model lifecycle (pull, remove, info)

§Design

  • Models are defined in model_catalog.toml embedded in the CLI binary
  • Models are downloaded from HuggingFace Hub on first use (lazy loading)
  • Models are cached to <project_root>/models/<name>.onnx
  • HF cache is also used (~/.cache/huggingface/hub/) for offline support

§Usage

use mecha10_cli::services::ModelService;

let service = ModelService::new()?;

// List catalog models
let catalog = service.list_catalog()?;

// Download a model
service.pull("yolov8n", None)?;

// List installed models
let installed = service.list_installed()?;

Structs§

InstalledModel
Installed model metadata
ModelCatalogEntry
Model catalog entry from model_catalog.toml
ModelInfo
Combined model information (catalog + installed)
ModelService
Model management service
QuantizeConfig
Quantization configuration for automatic INT8 conversion

Enums§

PreprocessingPreset
Preprocessing presets for common model families