Instructions to use gulding/EmsyAI with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use gulding/EmsyAI with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf gulding/EmsyAI:F32 # Run inference directly in the terminal: llama cli -hf gulding/EmsyAI:F32
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf gulding/EmsyAI:F32 # Run inference directly in the terminal: llama cli -hf gulding/EmsyAI:F32
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf gulding/EmsyAI:F32 # Run inference directly in the terminal: ./llama-cli -hf gulding/EmsyAI:F32
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf gulding/EmsyAI:F32 # Run inference directly in the terminal: ./build/bin/llama-cli -hf gulding/EmsyAI:F32
Use Docker
docker model run hf.co/gulding/EmsyAI:F32
- LM Studio
- Jan
- Ollama
How to use gulding/EmsyAI with Ollama:
ollama run hf.co/gulding/EmsyAI:F32
- Unsloth Studio
How to use gulding/EmsyAI with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for gulding/EmsyAI to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for gulding/EmsyAI to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for gulding/EmsyAI to start chatting
- Docker Model Runner
How to use gulding/EmsyAI with Docker Model Runner:
docker model run hf.co/gulding/EmsyAI:F32
- Lemonade
How to use gulding/EmsyAI with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull gulding/EmsyAI:F32
Run and chat with the model
lemonade run user.EmsyAI-F32
List all available models
lemonade list
- Atomic Chat
EmsyAI π§
EmsyAI is a complete, educational, decoder-only Transformer Language Model built entirely from mathematical first principles in pure PyTorch. The goal of this project is to demystify how modern LLMs (like Llama 3, Qwen 2.5, and DeepSeek) operate under the hood.
This is not a wrapper around the transformers library. Every single component was built from scratch:
- βοΈ Hand-rolled Byte-Pair Encoding (BPE) Tokenizer with native special token isolation (
<|eos|>,<|bos|>,<|pad|>) - π Rotary Positional Embeddings (RoPE) via complex polar tensor rotations
- β‘ Grouped Query Attention (GQA) with fused FlashAttention-2 (PyTorch SDPA)
- πͺ SwiGLU Feed-Forward Networks (3-matrix gated layout: $W_1, W_2, W_3$)
- βοΈ RMSNorm Pre-Normalization with numerical float32 upcasting
- πΎ Step-by-Step KV Caching for high-throughput autoregressive inference
- π― Multi-Layer Low-Rank Adaptation (LoRA) fine-tuning across all 7 linear projections
ποΈ Architecture Specifications
| Specification | EmsyAI-v2 (Current) | EmsyAI-v3 Titan (Active) |
|---|---|---|
| Parameters | 88.1 Million (Tied) | 178.5 Million (Tied) |
| Layers ($L$) | 12 | 16 |
| Hidden Dimension ($d_{\text{model}}$) | 768 | 896 |
| Attention Heads ($H_q / H_{kv}$) | 12 Query / 4 KV (GQA 3:1) | 14 Query / 2 KV (GQA 7:1) |
| FFN Dimension | 2,048 (SwiGLU) | 2,560 (SwiGLU) |
| Context Window ($T$) | 1,024 tokens | 4,096 tokens |
| Vocabulary Size | 16,000 (Hybrid BPE) | 16,000 (Hybrid BPE) |
| Attention Backend | FlashAttention-2 (F.scaled_dot_product_attention) |
FlashAttention-2 |
π Quickstart: Run in 5 Seconds via Ollama
You can run EmsyAI natively without installing PyTorch or GPU drivers:
ollama run hf.co/gulding/EmsyAI
π» Developer & Training Pipeline
This project uses uv for fast dependency management.
# 1. Clone the repository
git clone https://github.com/gulding/EmsyAI.git
cd EmsyAI
# 2. Install dependencies (PyTorch with CUDA 12.1)
uv sync
1. Data Engine & Tokenizer
# Stream 100k hybrid samples (Cosmopedia v2 + Python-25k)
uv run python data/download_v2.py
# Or stream the 150M Token Titan Dataset with Decontamination
uv run python data/download_v3.py
# Train the 16k BPE Tokenizer
uv run python scripts/train_tokenizer.py
2. Pretraining
# Pretrain EmsyAI-v2 (88M Model)
uv run python -m emsyai.training.train
# Pretrain EmsyAI-v3 Titan (180M Model @ 4,096 Context)
uv run python -m emsyai.training.train_v3
3. LoRA Instruction Fine-Tuning (SFT)
# Download 20k CodeAlpaca instruction dataset
uv run python -m emsyai.training.download_alpaca
# Train LoRA adapters across all linear layers
uv run python -m emsyai.training.finetune --steps 10000
4. Interactive Chat REPL
uv run python -m emsyai.chat_instruct \
--base_checkpoint checkpoints_v2/model_step_5000.pt \
--lora_checkpoint checkpoints_v2/lora/instruct_lora_step_10000.pt \
--tokenizer dataset/tokenizer_v2.json
π Prompt Template
When querying the instruction model, use the exact role tags:
[USER]
Write a Python function to check if a number is prime.
[MODEL]
π¬ Mathematical Verification Suite
Run our verification suite to mathematically validate attention causality and KV-cache consistency:
uv run python scripts/verify_model.py
- Downloads last month
- -
32-bit
Model tree for gulding/EmsyAI
Unable to build the model tree, the base model loops to the model itself. Learn more.