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
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -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
- Llama new
- LM Studio
- Jan
- vLLM
How to use gulding/EmsyAI with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "gulding/EmsyAI" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "gulding/EmsyAI", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/gulding/EmsyAI:F32
- Ollama
How to use gulding/EmsyAI with Ollama:
ollama run hf.co/gulding/EmsyAI:F32
- Unsloth Desktop
- 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
Update Model Card for Hugging Face audience
Browse files
README.md
CHANGED
|
@@ -1,121 +1,110 @@
|
|
| 1 |
-
---
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
-
|
| 8 |
-
-
|
| 9 |
-
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
EmsyAI is a
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
-
|
| 26 |
-
-
|
| 27 |
-
-
|
| 28 |
-
|
| 29 |
-
--
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
---
|
| 45 |
-
|
| 46 |
-
##
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
```
|
| 53 |
-
|
| 54 |
-
##
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
``
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
#
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
##
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
##
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
[
|
| 111 |
-
Write a Python function to check if a number is prime.
|
| 112 |
-
[MODEL]
|
| 113 |
-
```
|
| 114 |
-
|
| 115 |
-
## π¬ Mathematical Verification Suite
|
| 116 |
-
|
| 117 |
-
Run our verification suite to mathematically validate attention causality and KV-cache consistency:
|
| 118 |
-
|
| 119 |
-
```bash
|
| 120 |
-
uv run python scripts/verify_model.py
|
| 121 |
-
```
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
pipeline_tag: text-generation
|
| 4 |
+
language:
|
| 5 |
+
- en
|
| 6 |
+
tags:
|
| 7 |
+
- gguf
|
| 8 |
+
- llama.cpp
|
| 9 |
+
- ollama
|
| 10 |
+
- from-scratch
|
| 11 |
+
- educational
|
| 12 |
+
- pytorch
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# EmsyAI π§
|
| 16 |
+
|
| 17 |
+
EmsyAI is a small, decoder-only transformer language model built entirely from scratch in pure PyTorch β no `transformers` library, no pre-built blocks. It's an educational project: the goal is to demystify how models like Llama 3, Qwen 2.5, and DeepSeek work internally by actually building every piece β tokenizer, attention, RoPE, KV cache, LoRA β by hand.
|
| 18 |
+
|
| 19 |
+
Full training code, data pipeline, and developer docs live on [GitHub](https://github.com/gulding/EmsyAI). This page is about the model artifact itself: what it is, how to run it, and what to expect.
|
| 20 |
+
|
| 21 |
+
> [!WARNING]
|
| 22 |
+
> **Read this before you run it:** EmsyAI is a small model (88M active parameters, hosted here) trained on a small, narrow dataset. It is not a general-purpose assistant and won't behave like one β treat it as a working demonstration of a from-scratch LLM pipeline, not a production model. See [Limitations](#limitations).
|
| 23 |
+
|
| 24 |
+
### Built from scratch:
|
| 25 |
+
- βοΈ **Hand-rolled byte-pair encoding (BPE)** tokenizer
|
| 26 |
+
- π **Rotary position embeddings (RoPE)** via complex tensor rotation
|
| 27 |
+
- β‘ **Grouped-query attention (GQA)**, fused via `F.scaled_dot_product_attention`
|
| 28 |
+
- πͺ **SwiGLU** feed-forward layers
|
| 29 |
+
- βοΈ **RMSNorm** pre-normalization
|
| 30 |
+
- πΎ **KV caching** for autoregressive inference
|
| 31 |
+
- π― **LoRA fine-tuning** across all seven linear projections per block
|
| 32 |
+
|
| 33 |
+
## Quickstart
|
| 34 |
+
|
| 35 |
+
```bash
|
| 36 |
+
ollama run hf.co/gulding/EmsyAI
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
or with `llama.cpp`:
|
| 40 |
+
```bash
|
| 41 |
+
llama-cli -hf gulding/EmsyAI:F32
|
| 42 |
+
```
|
| 43 |
+
|
| 44 |
+
> **Note:** This currently pulls EmsyAI-v2 (88M params, 1,024-token context, LoRA-instruction-tuned). EmsyAI-v3 "Titan" (178M params, 4,096-token context) is still training and will replace it here once training and instruction-tuning are finished β see [Project Status](#project-status) for where that stands right now.
|
| 45 |
+
|
| 46 |
+
## Prompt format
|
| 47 |
+
|
| 48 |
+
```text
|
| 49 |
+
[USER]
|
| 50 |
+
Write a Python function to check if a number is prime.
|
| 51 |
+
[MODEL]
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
## What's in this repo
|
| 55 |
+
|
| 56 |
+
| File | What it is | Do you need it? |
|
| 57 |
+
|---|---|---|
|
| 58 |
+
| `emsyai-v2-instruct-f32.gguf` | v2 base model + LoRA adapter, merged and exported to GGUF | **Yes.** This is what Ollama / llama.cpp actually run |
|
| 59 |
+
| `base_model_120M_step_5000.pt` | Raw PyTorch inference weights | Only if loading it back into the [training code](https://github.com/gulding/EmsyAI) |
|
| 60 |
+
| `tokenizer.json` | The trained 16k-vocab BPE tokenizer | Only needed for the PyTorch path, not GGUF |
|
| 61 |
+
| `Modelfile` | Ollama configuration β prompt template, stop token, temperature | Used automatically by `ollama run` |
|
| 62 |
+
|
| 63 |
+
*(GGUF export maps the model's tensors onto llama.cpp's naming convention for Ollama/llama.cpp compatibility β that's why the architecture shows as `llama` in the metadata above. The training-time implementation itself is fully custom, not derived from Llama's code.)*
|
| 64 |
+
|
| 65 |
+
## Model Details
|
| 66 |
+
|
| 67 |
+
| Specification | EmsyAI-v2 (hosted here) | EmsyAI-v3 "Titan" (training, not yet published) |
|
| 68 |
+
|---|---|---|
|
| 69 |
+
| Parameters | 88.1M (tied embeddings) | 178.5M (tied embeddings) |
|
| 70 |
+
| Layers | 12 | 16 |
|
| 71 |
+
| Hidden dim | 768 | 896 |
|
| 72 |
+
| Attention heads | 12 Query / 4 KV (GQA 3:1) | 14 Query / 2 KV (GQA 7:1) |
|
| 73 |
+
| FFN dim | 2,048 (SwiGLU) | 2,560 (SwiGLU) |
|
| 74 |
+
| Context window | 1,024 tokens | 4,096 tokens |
|
| 75 |
+
| Vocab size | 16,000 (custom BPE) | 16,000 (custom BPE) |
|
| 76 |
+
| Position encoding | RoPE | RoPE |
|
| 77 |
+
|
| 78 |
+
**Training data (v2):** a ~100k-sample hybrid of Cosmopedia v2 (synthetic educational text) and a Python code subset, tokenized with the project's own BPE tokenizer. Instruction-tuned with LoRA (rank 8, alpha 16) on ~20k CodeAlpaca examples.
|
| 79 |
+
|
| 80 |
+
## Project status
|
| 81 |
+
|
| 82 |
+
v3 "Titan" is training now, on a ~150M-token decontaminated corpus (checked against HumanEval/MBPP so benchmark problems aren't memorized). In the interest of being upfront about where a from-scratch model actually is mid-training, here's the real trajectory so far β perplexity is measured against a 16,000-word vocabulary, so ~16,000 is what random guessing would score:
|
| 83 |
+
|
| 84 |
+
| Step | Validation perplexity | What the sample completions look like |
|
| 85 |
+
|---|---|---|
|
| 86 |
+
| 500 | 36,987 | Empty β too early to produce anything |
|
| 87 |
+
| 1,000 | 780 | Empty β still too early |
|
| 88 |
+
| 1,500 | 485 | Fluent-sounding prose, not yet coherent |
|
| 89 |
+
| 2,000 | 272 | Python-shaped syntax, not yet logically correct |
|
| 90 |
+
|
| 91 |
+
For example, at step 2,000, prompting with `def calculate_fibonacci(n):` produced:
|
| 92 |
+
```python
|
| 93 |
+
for j in range(nums) return -1[i] # Return the total += list2.56, 9:4 = 0 for i in arr: x // 2 == 1
|
| 94 |
+
```
|
| 95 |
+
Recognizably Python-flavored β indentation, keywords, a comment β but not yet logically sound. That's the expected order for a small model early in training: surface fluency and syntax arrive before semantic correctness. This card will be updated with the v3 GGUF and real samples once training and instruction-tuning are complete.
|
| 96 |
+
|
| 97 |
+
## Limitations
|
| 98 |
+
|
| 99 |
+
- **Small model, small data.** 88.1M active parameters trained on ~100k documents β closer in scale to early GPT-2-class experiments than to a modern assistant model.
|
| 100 |
+
- **Short context.** 1,024 tokens for the hosted v2 model.
|
| 101 |
+
- **No RLHF or preference tuning** β only supervised LoRA fine-tuning on instruction-following examples. Expect repetitive, sometimes factually wrong, or off-topic output, especially past a few sentences.
|
| 102 |
+
- **Code it writes may not run.** This project's own benchmark only checks that generated Python parses, not that it's logically correct β don't assume otherwise.
|
| 103 |
+
- **English only**, and narrow in domain (educational text and Python code).
|
| 104 |
+
|
| 105 |
+
## License
|
| 106 |
+
MIT β see [LICENSE](https://github.com/gulding/EmsyAI/blob/main/LICENSE).
|
| 107 |
+
|
| 108 |
+
## Links
|
| 109 |
+
- π» [Source code, training pipeline, and full docs](https://github.com/gulding/EmsyAI)
|
| 110 |
+
- π [Issues / discussions](https://github.com/gulding/EmsyAI/issues)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|