Skip to main content

A lightweight, trainable language model SDK

Project description

Umbrellm

A small language model framework that lets you train and run your own decoder-only transformer locally.

Overview

Umbrellm is a language model implementation written in Python and PyTorch. The default model configuration uses 12 transformer layers, 8 attention heads, and a hidden size of 512 dimensions, resulting in roughly 20 million parameters.

The goal of the project is to provide an implementation that is easy to understand and modify. It includes the components needed to train a model from scratch, prepare datasets, run inference, and expose the model through a simple API.

The architecture uses:

  • Rotary Position Embeddings (RoPE)
  • SwiGLU feed-forward activations
  • RMSNorm
  • Causal multi-head self-attention

Features

  • Train models from scratch using your own datasets
  • Save and resume training from checkpoints
  • Learning rate scheduling and gradient clipping
  • Optional mixed-precision training
  • BPE tokenizer training on custom corpora
  • Dataset compilation using the .ullm format
  • Text generation with temperature, top-k, top-p, and repetition penalty controls
  • Token-by-token streaming generation
  • FastAPI-based REST API server

Quick start

pip install torch fastapi uvicorn

python scripts/compile_dataset.py
python scripts/train.py --epochs 3
python scripts/inference.py --interactive

Python SDK

import umbrellm

umbrellm.utllm.compile()
umbrellm.training.train({"epochs": 3})

response = umbrellm.generate("Explain black holes simply.")
print(response)

Requirements

  • Python 3.9 or newer
  • PyTorch 2.0 or newer
  • FastAPI and uvicorn (only required for the API server)

License

Released under the MIT License.

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

umbrellm-0.1.0.tar.gz (20.7 kB view details)

Uploaded Source

Built Distribution

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

umbrellm-0.1.0-py3-none-any.whl (23.4 kB view details)

Uploaded Python 3

File details

Details for the file umbrellm-0.1.0.tar.gz.

File metadata

  • Download URL: umbrellm-0.1.0.tar.gz
  • Upload date:
  • Size: 20.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for umbrellm-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8ac5ff402cd3d4d2b8f752e04c57f45dca2bd954c32f2f53a43588ba8d727137
MD5 01172b5e38e4520d17fbecc981db6380
BLAKE2b-256 9043e2285c13fc0fda3582450799c604c1d257d1918d57e60ffd294dff901c38

See more details on using hashes here.

File details

Details for the file umbrellm-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: umbrellm-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 23.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for umbrellm-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 23dfb2381977f1ea6caf37a1417bbea74b3cb06790351af40b1be14a42026b14
MD5 760bb9c89efe754c68885e929e23593b
BLAKE2b-256 bbc5287ff71b1cb675a7eab0af57f52f966783ca68b5df6dcceaa9508875e791

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