TinyStories 260K for a 1998 iMac G3
This repository packages source and conversion tools for running a tiny TinyStories language model locally on a stock 1998 iMac G3 with 32 MB of RAM, Mac OS 8.5, and a 233 MHz PowerPC 750 processor.
The original project ports a small llama2.c-style TinyStories model to Classic
Mac OS. A prompt is written to prompt.txt; the app tokenizes it, runs local
transformer inference, and writes the generated continuation to output.txt.
This prepared Hugging Face package does not include generated big-endian model
files or a prebuilt Classic Mac app binary. It includes the runtime source,
Retro68 build files, and conversion script needed to produce the Mac-ready
artifacts from karpathy/tinyllamas.
Contents
source/imac_llm.c: Classic Mac OS inference runtime.source/imac_llm.r: Mac resource file.source/CMakeLists.txt: Retro68 build configuration.source/imac-llm-repo.tar.gz: archived source snapshot from the GitHub repo.scripts/endian_swap.py: converts Little Endian model/tokenizer files for PowerPC.
Model Lineage
The runtime targets karpathy/tinyllamas TinyStories 260K:
dim=64hidden_dim=172n_layers=5n_heads=8n_kv_heads=4vocab_size=512- checkpoint size around 1 MB
The Classic Mac port fixes the grouped-query attention weight layout for this model shape and byte-swaps the model/tokenizer for the PowerPC 750's big-endian architecture.
Build
Download the upstream model artifacts:
curl -L -o stories260K.bin https://huggingface.co/karpathy/tinyllamas/resolve/main/stories260K/stories260K.bin
curl -L -o tok512.bin https://huggingface.co/karpathy/tinyllamas/resolve/main/stories260K/tok512.bin
python3 scripts/endian_swap.py
Then build the Classic Mac OS app with Retro68:
mkdir build
cd build
cmake ../source -DCMAKE_TOOLCHAIN_FILE=/path/to/Retro68-build/toolchain/powerpc-apple-macos/cmake/retroppc.toolchain.cmake
make
Expected generated outputs from the original project include a MacBinary app, disk image, and Classic Mac application bundle depending on the Retro68 build configuration.
Runtime Target
- iMac G3 Rev B, October 1998
- 233 MHz PowerPC 750
- 32 MB RAM
- Mac OS 8.5
- no command line required on the target machine
Limitations
- Requires Retro68 for building.
- Requires manual transfer to the iMac over FTP/HTTP or another Classic Mac-friendly path.
- Requires increasing the Classic Mac app memory partition.
- Uses a tiny model intended for children's-story continuations, not assistant behavior.
- Big-endian generated model files are not included in this prepared package.
Citation and Links
- GitHub: https://github.com/maddiedreese/imac-llm
- Base artifacts: https://huggingface.co/karpathy/tinyllamas/tree/main/stories260K
- TinyStories paper: https://arxiv.org/abs/2305.07759
llama2.c: https://github.com/karpathy/llama2.c- Retro68: https://github.com/autc04/Retro68
Model tree for maddiedreese/tinystories-imac-g3
Base model
karpathy/tinyllamas