lmLite
Package version: 0.15.0
Browser machine learning from Python — run language models, embeddings, vision, speech and bare ONNX models entirely in your browser, and reach the microphone and camera, from a Python kernel in JupyterLite (or headless, with onnxruntime).
Try it, nothing to install: xeus-python (recommended) or Pyodide. Documentation · All notebooks
Quick start
from lmlite import LLM, Classifier, Embedder, pipeline
# Chat with a small instruction-tuned model
llm = await LLM.create(generator_model="HuggingFaceTB/SmolLM2-360M-Instruct", backend="wasm", dtype="q4")
print(await llm.chat([{"role": "user", "content": "Explain embeddings in simple terms."}]))
# Chat with memory: keep the conversation in a list and pass it back at each turn
history = [{"role": "user", "content": "What is Python?"}]
history.append({"role": "assistant", "content": await llm.chat(history)})
history.append({"role": "user", "content": "What can I use it for?"}) # "it" is Python
print(await llm.chat(history))
# Embeddings and similarity search
embedder = await Embedder.create("all-MiniLM-L6-v2")
docs = ["JupyterLite runs in the browser.", "Python is widely used for ML."]
print(await embedder.similarity_search("Where does JupyterLite run?", docs))
# Text classification
classifier = await Classifier.create("distilbert-base-uncased-finetuned-sst-2-english")
print(await classifier.classify("I love lmLite!", top_k=2))
# Any Transformers.js task is an awaitable callable: here, the objects in a photo
detector = await pipeline("object-detection", model="detr-resnet-50")
print(await detector("https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/cats.jpg", threshold=0.6))
What you get
pipeline(): Transformers.js tasks as awaitable Python callables (vision, speech, audio, images out, translation, zero-shot classification), withmap()over many inputs, progress and cancel.LLM,Embedder,Classifier: generation and chat with streaming and token probabilities; sentence embeddings with similarity search; text classification.OnnxModel: any single.onnxfile, NumPy in and NumPy out, with caching, hosted files and a SHA-256 check.- Notebook widgets: record the microphone, take a photo with the camera, manage the model cache.
- Local and private: inference runs in your browser, on WebAssembly or WebGPU, with no server and no API key. Downloaded models stay cached and can be exported as ZIP files.
- A headless native backend:
pip install 'lmlite[native]'runs the same ONNX files with onnxruntime, for fast tuning loops checked against the browser.
Extras: images (NumPy and Pillow), audio and camera (the widgets), native.
Note: Installing the package on a desktop does not run models in a browser.
pipeline(),OnnxModel,LLM,Embedder,Classifierand the widgets need a browser kernel (xeus-python or the JupyterLite Pyodide kernel) with JavaScript interoperability. The native extra coversEmbedder,Classifier, greedyLLM.generate(),OnnxModelandtokenizer(). See docs/RUNTIME.md.
Notebooks
Generated in the browser with SD-Turbo by the text-to-image notebook.
- Detect objects with the camera: take a photo on a laptop, tablet or phone and find the objects in it.
- Speak to the notebook: record your voice, transcribe it, or name the instrument you play.
- Pipelines that return images: background removal, depth estimation, segmentation and a 2x upscale.
- Text to image: SD-Turbo on WebGPU with prompt widgets (a hardware GPU and about 7 GB of memory).
- Chat with memory: a retrieval-augmented answer, then a multi-turn chat widget with conversation memory and streamed, stoppable answers.
All the notebooks, from the first demo to a retrieval-augmented chat, are listed in the documentation.
Apps, built with Voici: what is in front of the camera? and say it in English, hear it in French.
Documentation
The documentation site has the tutorials (the notebooks), guides for one task at a time, a reference with the API generated from the docstrings, and explanations of backends and the Python/JavaScript bridge. Setup and tests are in the development guide.
Contributing
lmLite is experimental. Feedback on the API, on other Transformers.js tasks to expose, and on model compatibility and browser limits is welcome through GitHub Issues.
Parts of this project were developed with the assistance of generative AI tools. The maintainer is responsible for the architecture, review, testing and published code. AI-assisted contributions are welcome, provided contributors understand, review and test their changes and take responsibility for them. AGENTS.md is a short guide to the layout, the commands and the usual mistakes, for people and for coding agents.
License
Apache License 2.0. See LICENSE. Models have their own licences, and some tested ones are non-commercial: check the model card before use, and see the model guide.
Citation
@software{lmlite2026,
author = {Decitre, Emmanuel},
title = {lmLite: Browser machine learning from Python},
year = {2026},
url = {https://github.com/decitre/lmlite}
}
Acknowledgements
lmLite builds on Transformers.js and ONNX Runtime for inference, on JupyterLite, xeus-python and Pyodide for Python in the browser, and on the models that the Hugging Face community publishes. The full list is on the credits page.
Metadata
Release files for lmlite 0.15.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| lmlite-0.15.0.tar.gz | 157.7 kB | With provenance | Details for lmlite-0.15.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| lmlite-0.15.0-py3-none-any.whl | Python 3 | none | any | Details for lmlite-0.15.0-py3-none-any.whl |
Total release size: 277.5 kB
Release files / lmlite-0.15.0.tar.gz
| Download URL | lmlite-0.15.0.tar.gz |
|---|---|
| Size | 157.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4a3c35cc9b6d46e8bf5655dba2423a725903119804a22b6a7f3282f768b19537
|
|
BLAKE2b-256 checksum How to use checksums |
c603127bc0ac4f82588999209ddf84a947b31e6cc7c9d93027b24ea42b6bbbda
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.
Transparency logRelease files / lmlite-0.15.0-py3-none-any.whl
| Download URL | lmlite-0.15.0-py3-none-any.whl |
|---|---|
| Size | 119.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
73541bda3aa28192dfb077dbbc5356f5b9bf3e894a72174f27d59d6ef51872ed
|
|
BLAKE2b-256 checksum How to use checksums |
1f8d8e6a7666fb347e107997ae6a756f72c5e3b28244e0dd310e6857905bcbbc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.
Transparency logSecurity for lmlite 0.15.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for lmlite-0.15.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.