Skip to main content

A unified runtime and developer layer for Small Language Models

Project description

SLM Packager

Run any small language model locally — one command.

SLM Packager is an open-source toolkit for running, packaging, and benchmarking Small Language Models (1B–7B parameters) across GGUF, PyTorch, and ONNX formats. One unified CLI. Three runtimes. Zero friction.

PyPI CI Coverage Python License Docs


Install

pip install slm-packager

Quickstart

# Pull a model
slm pull tinyllama

# Run it
slm run tinyllama --prompt "Explain transformers in one sentence"

# Benchmark it
slm benchmark tinyllama

That's it. Model downloads, auto-configures, and runs.


Pull Any HuggingFace Model

Not in the registry? Pull any GGUF or ONNX directly:

slm pull Qwen/Qwen3-4B-GGUF Qwen3-4B-Q4_K_M.gguf --name qwen3-4b
slm run qwen3-4b --prompt "Hello!"

Available Models

Model Size Runtime Best For
gpt2 500MB transformers Fast testing, MPS
tinyllama 637MB llama.cpp CPU-efficient chat
phi-2 1.6GB llama.cpp Reasoning tasks
qwen-1.8b 1.1GB llama.cpp Multilingual chat
slm list                          # all registry models
slm pull phi-2 --list-variants    # see quantization options

Real Benchmarks (M3 Pro · 18GB)

Model Runtime Device Tokens/sec
GPT-2 124M transformers CPU 53.16
GPT-2 124M transformers MPS ⚡ 28.06
TinyLlama 1.1B llama.cpp CPU 9.19
Phi-2 2.7B llama.cpp CPU 33.67
Qwen3 4B llama.cpp CPU 31.71

Run your own: slm benchmark <model>


GPU Acceleration

Apple Silicon (MPS) — zero setup

slm init --name gpt2 --path gpt2 --format pytorch \
         --runtime transformers --device mps -o gpt2-mps.yaml
slm run gpt2-mps.yaml --prompt "Hello!"

NVIDIA (CUDA)

CMAKE_ARGS="-DLLAMA_CUBLAS=on" pip install llama-cpp-python --no-cache-dir
# then set gpu_layers in your YAML config

CLI Reference

slm list                              # registry models
slm list --installed                  # downloaded models
slm pull <model>                      # download from registry
slm pull <hf-repo> <file> --name x   # pull any HF GGUF/ONNX
slm run <model> --prompt "..."        # generate text
slm benchmark <model>                 # speed + memory metrics
slm serve --port 8000                 # start FastAPI server
slm quantize input.gguf --type q4_k_m
slm init                              # create YAML config interactively
slm rm <model>                        # remove installed model

API Server

slm serve --port 8000
curl -X POST http://localhost:8000/generate \
  -H "Content-Type: application/json" \
  -d '{"prompt": "The future of AI is", "params": {"max_tokens": 100}}'

Supports streaming ("stream": true) and async model loading.


YAML Config

model:
  name: my-model
  path: /path/to/model.gguf
  format: gguf

runtime:
  type: llama_cpp
  device: cpu
  threads: 8
  context_size: 2048

params:
  temperature: 0.7
  max_tokens: 512
  stream: true

Documentation

Full docs at ayo-cyber.github.io/slm-packager


Development

git clone https://github.com/Ayo-Cyber/slm-packager.git
cd slm-packager
pip install -e ".[dev]"
pytest

117 tests · 52% coverage · CI on every push


License

Apache 2.0 — see LICENSE

Issues / Discussions: github.com/Ayo-Cyber/slm-packager

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

slm_packager-0.2.2.tar.gz (40.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

slm_packager-0.2.2-py3-none-any.whl (40.2 kB view details)

Uploaded Python 3

File details

Details for the file slm_packager-0.2.2.tar.gz.

File metadata

  • Download URL: slm_packager-0.2.2.tar.gz
  • Upload date:
  • Size: 40.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for slm_packager-0.2.2.tar.gz
Algorithm Hash digest
SHA256 f75d18f2b1c0daf9938db5128132baf9c2af40c86ce5c57c6a01d55158674c26
MD5 67b79151cffe4b10a673380ff8d62cd1
BLAKE2b-256 eed8e05060863e1c11cc13ea0347d49b36b008e6c49ef49fb8f00aa10de35154

See more details on using hashes here.

File details

Details for the file slm_packager-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: slm_packager-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 40.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for slm_packager-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d394018137daa47aaa60f026268f1efa663c7dcc1eb3fa959375d8e56dfdb280
MD5 af45e54ac7351445ae536bc542617933
BLAKE2b-256 7cf81465cf4eaa37017a5eb7f9609e61add6957582b7c6411eec8b3ddad97a41

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page