This release is a pre-release and may not be stable for production use.
mila-llm
The LLM stack you can read and understand.
Mila is a C++23/CUDA runtime for open large language models — inference and training, built from explicit neural-network components. Device and precision are compile-time decisions, every forward pass is explicit, and there is no hidden execution engine. This package is its Python projection.
pip install mila-llm
import mila
mila.initialize("warning")
# Once: fetch a published model into the local store (~6.3 GB).
mila.ModelStore().pull("gemma-4-12b-it-fp4", mila.default_hub_owner())
tokenizer = mila.BpeTokenizer.from_store("gemma-4-12b-it-fp4")
model = mila.GemmaModel.from_store("gemma-4-12b-it-fp4", 4096)
model.generate_streaming(tokenizer.encode(prompt), print)
A model is named, not pathed. from_store reads the local store's record, which is
what knows the artifact is already FP4 — so nothing pairs a weights path with a
tokenizer path, and nothing has to be told what the bytes are. Pull and load are
separate verbs: a load never reaches the network, so an uninstalled name is an
error rather than a surprise download.
The GIL is released around generation, so a streaming callback runs on a live
interpreter and StopController cancels a decode loop already in flight.
Requirements
An NVIDIA GPU. The CUDA runtime libraries arrive as dependencies
(nvidia-cublas, nvidia-curand, and nvidia-cuda-runtime on Linux, where the
extension links cudart dynamically) — no CUDA Toolkit installation is required.
An installed Toolkit is used as a fallback if those are absent.
gemma-4-12b-it-fp4 wants roughly 12 GB of VRAM at a 4096 context; a Llama 3.2 3B
is the smaller first run.
What it exposes
| Symbol | Members |
|---|---|
mila.initialize |
log_level = trace | info | warning | error |
mila.BpeTokenizer |
from_store(name), load_llama32, load_gemma, encode, decode, token_to_string, is_valid_token, vocab_size, bos_token_id, eos_token_id, pad_token_id |
mila.GemmaModel |
from_store(name, context_length, device_index=0), from_pretrained(path, context_length, device_index=0, quantization="fp4"), generate, generate_streaming, get_config |
mila.LlamaModel |
from_store(name, context_length, device_index=0), from_pretrained(path, context_length, device_index=0, quantization="bf16"), generate, generate_streaming, get_config |
mila.ModelStore |
root, list, locate, remove, usage, install, pull, list_hub_models |
mila.StopController |
request_stop, stop_requested |
The store is shared with Mila's chat harness and inference server, so a model installed by any of them is loadable by all of them.
What it does not
Stated because the limits are documentation, not an omission from it.
- No weights are bundled. They are fetched on request into a local store, over a transport this package supplies from the standard library — the wheel carries no HTTP client of its own.
- A load never downloads.
pullandfrom_storeare separate calls on purpose. - No GPT-2. It exists in the C++ library and is not bound.
- A published artifact's quantization is fixed — its bytes are already FP4 or FP8. Choosing a quantization applies only to an unquantized artifact loaded by path.
- No training, no batching, and a model instance is not thread-safe: serialize calls through a single worker thread.
- Text in, text out. No embeddings, logits, or hidden-state access.
Links
- Documentation: https://mila.toddt.me
- Source: https://github.com/toddthomson/Mila
- Models: https://huggingface.co/mila-llm — what
pullfetches from
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
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
File details
Details for the file mila_llm-0.20.0b2-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: mila_llm-0.20.0b2-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 5.4 MB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9127ef9668a62e165182e99b78262eeb38298533c752d829a1fd28d4d93e22e2
|
|
| MD5 |
4d67e252cb4638b3f09ae8f201a9e7d9
|
|
| BLAKE2b-256 |
03dc53fa92c106d83d5c28e28d8a9bf8e3bff9731a546d3cf3b3de5e4c8c9533
|
File details
Details for the file mila_llm-0.20.0b2-cp313-cp313-manylinux_2_38_x86_64.whl.
File metadata
- Download URL: mila_llm-0.20.0b2-cp313-cp313-manylinux_2_38_x86_64.whl
- Upload date:
- Size: 6.5 MB
- Tags: CPython 3.13, manylinux: glibc 2.38+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ed4c3d489a4bfd76a3b77c7dd174c79737732a4719dd149e278437f3c44830e
|
|
| MD5 |
f100d171ed82f10e2e19f942b60c6d8b
|
|
| BLAKE2b-256 |
5fe7fb6b495dcef9b337efc24244a13a616647e4ba68e0255fbdd0b83181a6c9
|
File details
Details for the file mila_llm-0.20.0b2-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: mila_llm-0.20.0b2-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 5.4 MB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8bb864f0bb03623212664babc752b57149edf05f27659ea256b6ba045cd5225c
|
|
| MD5 |
f7db379569658dcf40f301eb33f89916
|
|
| BLAKE2b-256 |
f73ec6f9f4e7af5fd38153194ac83cb7057ca38392a2b62b65d61b353d7ac7f1
|
File details
Details for the file mila_llm-0.20.0b2-cp312-cp312-manylinux_2_38_x86_64.whl.
File metadata
- Download URL: mila_llm-0.20.0b2-cp312-cp312-manylinux_2_38_x86_64.whl
- Upload date:
- Size: 6.5 MB
- Tags: CPython 3.12, manylinux: glibc 2.38+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c8edfd4b9e9716c1ae93157db5fa662aa88dc6f6b5a36b493d47d1fd6664d715
|
|
| MD5 |
612c6d3bbf43eccb0ceeb6101120de97
|
|
| BLAKE2b-256 |
caf248fe184391310cf11b9602fa8f89ee09e53b5b6287a446bb1d624cb28f10
|