MCPcopy Create free account
hub / github.com/algorithmicsuperintelligence/optillm / __init__

Method __init__

optillm/inference.py:304–321  ·  view source on GitHub ↗
(self, model_config: MLXModelConfig, cache_manager)

Source from the content-addressed store, hash-verified

302 """MLX-based inference pipeline that mirrors PyTorch pipeline interface"""
303
304 def __init__(self, model_config: MLXModelConfig, cache_manager):
305 self.model_config = model_config
306 self.cache_manager = cache_manager
307 self.last_used = time.time()
308
309 if not MLX_AVAILABLE:
310 raise RuntimeError("MLX framework not available. Install with: pip install mlx-lm")
311
312 if not is_apple_silicon():
313 raise RuntimeError("MLX framework is only supported on Apple Silicon")
314
315 try:
316 logger.info(f"Loading MLX model: {model_config.model_id}")
317 self.model, self.tokenizer = self._load_mlx_model(model_config.model_id)
318 logger.info("MLX model loaded successfully")
319 except Exception as e:
320 logger.error(f"Failed to load MLX model: {str(e)}")
321 raise
322
323 def _load_mlx_model(self, model_id: str):
324 """Load MLX model and tokenizer with caching"""

Callers

nothing calls this directly

Calls 2

_load_mlx_modelMethod · 0.95
is_apple_siliconFunction · 0.85

Tested by

no test coverage detected