MLX-based LLM training and inference with hybrid RL architecture
Project description
Lazarus
MLX-based LLM training framework for Apple Silicon.
Installation
# Clone the repository
git clone https://github.com/your-org/chuk-mlx.git
cd chuk-mlx
# Install with uv (recommended)
uv sync
# Or with pip
pip install -e .
Quick Start
Python API
from chuk_lazarus.models import load_model, generate_response
# Load a model
model, tokenizer = load_model("TinyLlama/TinyLlama-1.1B-Chat-v1.0")
# Generate text
response = generate_response(
model=model,
tokenizer=tokenizer,
prompt="Once upon a time",
max_tokens=100,
temperature=0.7,
)
print(response)
CLI
Lazarus provides a unified CLI for training, inference, and tokenizer utilities.
# Run inference
lazarus infer --model TinyLlama/TinyLlama-1.1B-Chat-v1.0 --prompt "Hello, world!"
# Train with SFT
lazarus train sft --model TinyLlama/TinyLlama-1.1B-Chat-v1.0 --data train.jsonl --use-lora
# Train with DPO
lazarus train dpo --model ./checkpoints/sft/final --data preferences.jsonl
# Generate synthetic training data
lazarus generate --type math --output ./data/lazarus
# Tokenizer utilities
lazarus tokenizer encode -t TinyLlama/TinyLlama-1.1B-Chat-v1.0 --text "Hello world"
lazarus tokenizer vocab -t TinyLlama/TinyLlama-1.1B-Chat-v1.0 --search "hello"
Features
- Training: SFT, DPO, GRPO, PPO trainers with LoRA support
- Models: LLaMA, Mistral, Gemma, Granite, StarCoder2, TinyLlama
- Data: Dataset classes, synthetic data generators
- CLI: Unified command-line interface for all operations
- Tokenizer Tools: Encode, decode, vocabulary inspection, comparison
Documentation
Examples
See the examples/ directory for detailed examples organized by area:
examples/tokenizer/- Tokenization examplesexamples/inference/- Text generationexamples/training/- SFT and DPO trainingexamples/data/- Data handling and generationexamples/models/- Model loading and configuration
Project Structure
src/chuk_lazarus/
├── cli/ # Command-line interface
├── data/ # Datasets, generators, tokenizers
├── models/ # Model architectures and loading
├── training/ # Trainers (SFT, DPO, GRPO, PPO)
├── inference/ # Text generation
└── utils/ # Utilities
License
MIT
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
chuk_lazarus-0.2.0.tar.gz
(192.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
chuk_lazarus-0.2.0-py3-none-any.whl
(278.9 kB
view details)
File details
Details for the file chuk_lazarus-0.2.0.tar.gz.
File metadata
- Download URL: chuk_lazarus-0.2.0.tar.gz
- Upload date:
- Size: 192.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
75af8d38b5c15f032b44a7ad9349095759a60ffb3690c187beec265c175a8f10
|
|
| MD5 |
3d645ce29af26c153766d2622dab1876
|
|
| BLAKE2b-256 |
a7befb24e56d295b11d72e47d9fc422b62a98ee1422123d81c4941ba2d7dc436
|
File details
Details for the file chuk_lazarus-0.2.0-py3-none-any.whl.
File metadata
- Download URL: chuk_lazarus-0.2.0-py3-none-any.whl
- Upload date:
- Size: 278.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee89e894a373ed7efc39e315a63c69a8547f752980a71157f6cc0961046d4ba3
|
|
| MD5 |
9b88ab1e96c7dace21e3587fb3e4a28f
|
|
| BLAKE2b-256 |
ad535db208307f3404322d7cd1908ddcfabc0b0937ce5f800a596ab8af711a83
|