mirror of
https://github.com/cloudstack-llc/mlx-knife.git
synced 2026-07-24 12:17:06 -04:00
57bf6d86be
Major Features Added: • Complete run command implementation with interactive/single-shot modes • MLXRunner core engine ported from 1.x with modular architecture • OpenAI-compatible server with SIGINT-robust supervisor mode • Experimental push feature properly isolated behind environment variable Key Improvements: - Full feature parity with 1.1.1 stable releases - Enhanced human output formatting across all commands - Clean separation of stable (184 tests) vs experimental features - Updated demo GIF showcasing improved 2.0 interface Fixes: - Pull operation cache pollution (Issue #30) with preflight access checks - Test stability improvements across all environments Architecture: - Modular runner design with focused helper modules - Thread-safe model loading and memory management - stable testing across Python 3.9-3.13 Ready for use as comprehensive 1.x alternative.
40 lines
872 B
Python
40 lines
872 B
Python
"""Lightweight test stub for mlx.core to avoid native deps in unit tests.
|
|
|
|
Only implements the minimal API surface used by the 2.0 unit tests and runner:
|
|
- zeros(n)
|
|
- array(x)
|
|
- clear_cache()
|
|
- get_active_memory()
|
|
"""
|
|
|
|
class _Array:
|
|
def __init__(self, data):
|
|
self._data = data
|
|
|
|
def item(self):
|
|
# mimic behavior of mx.array([...]).item() -> first element
|
|
if isinstance(self._data, (list, tuple)):
|
|
return self._data[0]
|
|
return self._data
|
|
|
|
|
|
def zeros(n):
|
|
# Return a simple Python list as a stand-in
|
|
return [0] * (n if isinstance(n, int) else 1)
|
|
|
|
|
|
def array(x):
|
|
# Wrap in simple array-like with .item()
|
|
return _Array(x if isinstance(x, (list, tuple)) else [x])
|
|
|
|
|
|
def clear_cache():
|
|
# No-op for tests
|
|
return None
|
|
|
|
|
|
def get_active_memory():
|
|
# Return a tiny deterministic value (bytes)
|
|
return 0
|
|
|