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

Class MLXManager

optillm/inference.py:590–616  ·  view source on GitHub ↗

Manager for MLX models and operations

Source from the content-addressed store, hash-verified

588 pass
589
590class MLXManager:
591 """Manager for MLX models and operations"""
592
593 def __init__(self, cache_manager):
594 self.cache_manager = cache_manager
595 self.available = MLX_AVAILABLE and is_apple_silicon()
596
597 if self.available:
598 logger.info("MLX manager initialized - Apple Silicon detected")
599 else:
600 logger.debug("MLX manager not available - requires Apple Silicon and mlx-lm")
601
602 def create_pipeline(self, model_id: str, **kwargs) -> MLXInferencePipeline:
603 """Create an MLX inference pipeline"""
604 if not self.available:
605 raise RuntimeError("MLX not available on this platform")
606
607 config = MLXModelConfig(
608 model_id=model_id,
609 **kwargs
610 )
611
612 return MLXInferencePipeline(config, self.cache_manager)
613
614 def is_mlx_model(self, model_id: str) -> bool:
615 """Check if model should use MLX"""
616 return should_use_mlx(model_id)
617
618class MemoryEfficientAttention(nn.Module):
619 """

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected