ScaleLLM AI
scalellm-ai is a tiny high-level Python toolkit for building AI applications with very little code.
It now supports scratch-trained models for:
- LLMs
- image generation
- video generation
- text-to-speech
It also still includes easy wrappers around strong pretrained models for images, video, TTS, vision, speech recognition, embeddings, text generation, and zero-shot classification.
Important reality check
The scratch-trained image, video, and TTS models are real trainable models from random weights, but they are toy-sized starter architectures meant for learning and experimentation.
That means:
- you can genuinely train them from scratch
- they can learn small custom datasets
- they will not match Stable Diffusion, Sora, or commercial TTS quality
- they are designed so the user-facing code stays under 20 lines
Install
Core package:
pip install scalellm-ai
Feature installs:
pip install "scalellm-ai[image]"
pip install "scalellm-ai[video]"
pip install "scalellm-ai[tts]"
pip install "scalellm-ai[game]"
pip install "scalellm-ai[all]"
1. Train your own tiny LLM from scratch
from scalellm_ai import ScaleLLM
llm = ScaleLLM(d_model=128, n_layer=4, n_head=4, max_seq_len=128)
text = open("dataset.txt", encoding="utf-8").read()
llm.train(text, steps=500, batch_size=4)
print(llm.generate("Python is", max_new_tokens=80))
llm.save("my_llm.pt")
2. Train an image model from scratch
Manifest format:
images/cat1.png|orange cat
images/car1.png|red sports car
from scalellm_ai import ImageAI
ai = ImageAI.from_scratch(image_size=32)
ai.train("image_manifest.txt", epochs=20)
ai.generate("red sports car", output="car.png")
ai.save("my_image_ai.pt")
3. Train a video model from scratch
Manifest format:
clips/fly.gif|bird flying
clips/wave.gif|ocean waves
from scalellm_ai import VideoAI
video = VideoAI.from_scratch(image_size=32, num_frames=8)
video.train("video_manifest.txt", epochs=20)
video.generate("bird flying", output="bird.gif", fps=6)
video.save("my_video_ai.pt")
4. Train a TTS model from scratch
Manifest format:
hello.wav|hello world
welcome.wav|welcome to scale llm ai
from scalellm_ai import TTS
voice = TTS.from_scratch(sample_rate=8000, seconds=1.0)
voice.train("tts_manifest.txt", epochs=20)
voice.speak("hello world", output="hello.wav")
voice.save("my_tts.pt")
5. Pretrained image generation
from scalellm_ai import ImageAI
ai = ImageAI()
ai.generate("cinematic robot exploring an ancient library", output="robot.png")
6. Pretrained video generation
from scalellm_ai import VideoAI
video = VideoAI()
video.generate("a small spacecraft flying through glowing blue clouds", output="space.mp4")
7. Pretrained TTS
from scalellm_ai import TTS
voice = TTS()
voice.speak("ScaleLLM AI can turn this sentence into speech.", output="speech.wav")
8. Game-playing AI
from scalellm_ai import GameAI
agent = GameAI("CartPole-v1", algorithm="PPO", verbose=1)
agent.train(20_000)
agent.save("cartpole_agent")
9. Vision AI
from scalellm_ai import VisionAI
vision = VisionAI()
for result in vision.classify("photo.jpg", top_k=3):
print(result["label"], result["score"])
10. Speech-to-text
from scalellm_ai import SpeechAI
speech = SpeechAI()
print(speech.transcribe("meeting.wav"))
11. Embeddings / semantic similarity
from scalellm_ai import EmbedAI
embed = EmbedAI()
print(embed.similarity("A dog is running outside.", "A puppy is playing outdoors."))
12. Pretrained text generation
from scalellm_ai import TextAI
ai = TextAI()
print(ai.generate("Explain neural networks simply:", max_new_tokens=120))
13. Zero-shot classifier
from scalellm_ai import ClassifyAI
ai = ClassifyAI()
result = ai.classify("The team won the championship last night.", ["sports", "business", "science"])
print(result["labels"][0])
14. Music / text-to-audio
from scalellm_ai import MusicAI
music = MusicAI()
music.generate("energetic retro arcade synthwave with a heroic melody", output="theme.wav")
15. Object detection
from scalellm_ai import ObjectAI
ai = ObjectAI()
for obj in ai.detect("street.jpg", threshold=0.7):
print(obj["label"], obj["score"], obj["box"])
Notes on scratch datasets
- ImageAI.from_scratch expects a manifest with
image_path|caption - VideoAI.from_scratch expects a manifest with
video_path|caption - TTS.from_scratch expects a manifest with
audio_path|text - all scratch models start from random weights
- all scratch models are kept intentionally small so they can be understood and extended
Examples
Every file in examples/ is intentionally 20 lines or fewer.
Publishing safely
Install the publishing tools first with pip install "scalellm-ai[dev]".
Never put PyPI tokens in publish.py. Set the token in your shell instead:
PowerShell:
$env:PYPI_API_TOKEN="pypi-..."
python publish.py
macOS/Linux:
export PYPI_API_TOKEN="pypi-..."
python publish.py
License
MIT. Individual pretrained models can have their own licenses and usage terms; check model cards before redistribution or commercial use.
Metadata
Release files for scalellm-ai 0.3.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 | |
|---|---|---|---|
| scalellm_ai-0.3.0.tar.gz | 19.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| scalellm_ai-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 41.1 kB
Release files / scalellm_ai-0.3.0.tar.gz
| Download URL | scalellm_ai-0.3.0.tar.gz |
|---|---|
| Size | 19.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
05dfa017cbb170ec77fcc9083c4baaba50554735ad3f1323b49e6dfadc3753a8
|
|
BLAKE2b-256 checksum How to use checksums |
96689161ff86b0eabe9231b15058688b9fd2d7d1e41e6c6139d7ee349bc0f1db
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.5
|
Release files / scalellm_ai-0.3.0-py3-none-any.whl
| Download URL | scalellm_ai-0.3.0-py3-none-any.whl |
|---|---|
| Size | 22.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
98e364ef03dbbebd8e4e51279c20d07f0e1852bf33f1c2d8d0bd32b9db1265b2
|
|
BLAKE2b-256 checksum How to use checksums |
eddb7fb65f96ae3ef4b4481c8aa36c56de065ddb076dc70a4570936589178397
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.5
|