Text Generation
MLX
Safetensors
English
information-extraction
structured-output
json
small-language-model
apple-silicon
from-scratch
post-training
research
Instructions to use wzebrowski/OpenSML-JSONLite-175M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use wzebrowski/OpenSML-JSONLite-175M with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # if on a CUDA device, also pip install mlx[cuda] # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("wzebrowski/OpenSML-JSONLite-175M") prompt = "Once upon a time in" text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- MLX LM
How to use wzebrowski/OpenSML-JSONLite-175M with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Generate some text mlx_lm.generate --model "wzebrowski/OpenSML-JSONLite-175M" --prompt "Once upon a time"
- Atomic Chat
Download inference.py from wzebrowski/OpenSML-JSONLite-175M: direct link, hf CLI and curl.
- Browser
- Download file 1.56 kB
-
https://huggingface.co/wzebrowski/OpenSML-JSONLite-175M/resolve/main/inference.py
- Command line
-
hf download hf://wzebrowski/OpenSML-JSONLite-175M/inference.py
-
curl -L -o inference.py https://huggingface.co/wzebrowski/OpenSML-JSONLite-175M/resolve/main/inference.py
1.56 kB
| #!/usr/bin/env python3 | |
| """Run JSONLite offline with the bundled native MLX implementation. | |
| Defaults to model.safetensors beside this script. The verified source bundle | |
| includes the exact model architecture, tokenizer, native JSON prompt/decoder and examples. | |
| """ | |
| from pathlib import Path | |
| import hashlib | |
| import runpy | |
| import sys | |
| import tempfile | |
| import zipfile | |
| ROOT = Path(__file__).resolve().parent | |
| BUNDLE_SHA256 = "8f5a075f63e1ff8857af3ddd916afc57742e614b1da5cbbe15452e9c84e94d2a" | |
| def main(): | |
| archive = ROOT / "native_bundle.zip" | |
| if not archive.is_file(): | |
| raise SystemExit("Missing native_bundle.zip; download the complete repository.") | |
| if hashlib.sha256(archive.read_bytes()).hexdigest() != BUNDLE_SHA256: | |
| raise SystemExit("Native source bundle failed its integrity check.") | |
| if not any(arg == "--weights" or arg.startswith("--weights=") for arg in sys.argv[1:]): | |
| sys.argv.extend(["--weights", str(ROOT / "model.safetensors")]) | |
| with tempfile.TemporaryDirectory(prefix="jsonlite-runtime-") as directory: | |
| runtime = Path(directory) | |
| with zipfile.ZipFile(archive) as bundle: | |
| for member in bundle.infolist(): | |
| path = Path(member.filename) | |
| if path.is_absolute() or ".." in path.parts or (member.external_attr >> 16) & 0o170000 == 0o120000: | |
| raise SystemExit("Unsafe source-bundle entry.") | |
| bundle.extractall(runtime) | |
| runpy.run_path(str(runtime / "inference.py"), run_name="__main__") | |
| if __name__ == "__main__": | |
| main() | |