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
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,99 +1,117 @@
|
|
| 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 (V3 Titan is 154M parameters) 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 |
-
By default, we serve the latest **V3 Titan** architecture (154M parameters, 4,096-token context window).
|
| 36 |
-
|
| 37 |
-
```bash
|
| 38 |
-
ollama run hf.co/gulding/EmsyAI
|
| 39 |
-
```
|
| 40 |
-
|
| 41 |
-
or with `llama.cpp`:
|
| 42 |
-
```bash
|
| 43 |
-
llama-cli -hf gulding/EmsyAI:F32
|
| 44 |
-
```
|
| 45 |
-
|
| 46 |
-
> **Note:** If you are looking for the older **V2** architecture (88M params, 1,024-token context), the `emsyai-v2-instruct-f32.gguf` file is still available in the Files tab.
|
| 47 |
-
|
| 48 |
-
## Prompt format
|
| 49 |
-
|
| 50 |
-
```text
|
| 51 |
-
[USER]
|
| 52 |
-
Write a Python function to check if a number is prime.
|
| 53 |
-
[MODEL]
|
| 54 |
-
```
|
| 55 |
-
|
| 56 |
-
## What's in this repo
|
| 57 |
-
|
| 58 |
-
| File | What it is | Do you need it? |
|
| 59 |
-
|---|---|---|
|
| 60 |
-
| `emsyai-v3-titan-instruct-f32.gguf` | **v3 Titan** base model + LoRA adapter, merged and exported to GGUF | **Yes.** This is what Ollama / llama.cpp actually run by default |
|
| 61 |
-
| `emsyai-v2-instruct-f32.gguf` | **v2** base model + LoRA adapter, merged and exported to GGUF | Optional. Legacy 88M architecture |
|
| 62 |
-
| `base_model_154M_step_5000.pt` | Raw PyTorch inference weights | Only if loading it back into the [training code](https://github.com/gulding/EmsyAI) |
|
| 63 |
-
| `tokenizer.json` | The trained 16k-vocab BPE tokenizer | Only needed for the PyTorch path, not GGUF |
|
| 64 |
-
| `Modelfile` | Ollama configuration β prompt template, stop token, temperature | Used automatically by `ollama run` |
|
| 65 |
-
|
| 66 |
-
*(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.)*
|
| 67 |
-
|
| 68 |
-
## Model Details
|
| 69 |
-
|
| 70 |
-
| Specification | EmsyAI-v3 "Titan" (Latest) | EmsyAI-v2 (Legacy) |
|
| 71 |
-
|---|---|---|
|
| 72 |
-
| Parameters | 153.8M (tied embeddings) | 88.1M (tied embeddings) |
|
| 73 |
-
| Layers | 16 | 12 |
|
| 74 |
-
| Hidden dim | 896 | 768 |
|
| 75 |
-
| Attention heads | 14 Query / 2 KV (GQA 7:1) | 12 Query / 4 KV (GQA 3:1) |
|
| 76 |
-
| FFN dim | 2,560 (SwiGLU) | 2,048 (SwiGLU) |
|
| 77 |
-
| Context window | 4,096 tokens | 1,024 tokens |
|
| 78 |
-
| Vocab size | 16,000 (custom BPE) | 16,000 (custom BPE) |
|
| 79 |
-
| Position encoding | RoPE | RoPE |
|
| 80 |
-
|
| 81 |
-
**Training data (V3 Titan):** a ~150M-token hybrid of Cosmopedia v2 (synthetic educational text) and a Python code subset, tokenized with the project's own BPE tokenizer. Strict 10-gram decontamination was run against HumanEval and MBPP. Instruction-tuned with LoRA (rank 8, alpha 16) on ~20k CodeAlpaca examples with masked prompt loss.
|
| 82 |
-
|
| 83 |
-
## Project status
|
| 84 |
-
|
| 85 |
-
**V3 Titan is complete.** The model successfully converged during 5,000 steps of pretraining on the 150M-token corpus, followed by 10,000 steps of LoRA instruction tuning. Prompt loss masking (-100) successfully eliminated base-model "topic drift", resulting in a model that strictly outputs the desired python format.
|
| 86 |
-
|
| 87 |
-
## Limitations
|
| 88 |
-
|
| 89 |
-
- **Small model, small data.** 154M active parameters trained on ~150M tokens β closer in scale to early GPT-2-class experiments than to a modern assistant model.
|
| 90 |
-
- **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.
|
| 91 |
-
- **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.
|
| 92 |
-
- **English only**, and narrow in domain (educational text and Python code).
|
| 93 |
-
|
| 94 |
-
## License
|
| 95 |
-
MIT β see [LICENSE](https://github.com/gulding/EmsyAI/blob/main/LICENSE).
|
| 96 |
-
|
| 97 |
-
## Links
|
| 98 |
-
- π» [Source code, training pipeline, and full docs](https://github.com/gulding/EmsyAI)
|
| 99 |
-
- π¬ [Issues / discussions](https://github.com/gulding/EmsyAI/issues)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 (V3 Titan is 154M parameters) 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 |
+
By default, we serve the latest **V3 Titan** architecture (154M parameters, 4,096-token context window).
|
| 36 |
+
|
| 37 |
+
```bash
|
| 38 |
+
ollama run hf.co/gulding/EmsyAI
|
| 39 |
+
```
|
| 40 |
+
|
| 41 |
+
or with `llama.cpp`:
|
| 42 |
+
```bash
|
| 43 |
+
llama-cli -hf gulding/EmsyAI:F32
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
> **Note:** If you are looking for the older **V2** architecture (88M params, 1,024-token context), the `emsyai-v2-instruct-f32.gguf` file is still available in the Files tab.
|
| 47 |
+
|
| 48 |
+
## Prompt format
|
| 49 |
+
|
| 50 |
+
```text
|
| 51 |
+
[USER]
|
| 52 |
+
Write a Python function to check if a number is prime.
|
| 53 |
+
[MODEL]
|
| 54 |
+
```
|
| 55 |
+
|
| 56 |
+
## What's in this repo
|
| 57 |
+
|
| 58 |
+
| File | What it is | Do you need it? |
|
| 59 |
+
|---|---|---|
|
| 60 |
+
| `emsyai-v3-titan-instruct-f32.gguf` | **v3 Titan** base model + LoRA adapter, merged and exported to GGUF | **Yes.** This is what Ollama / llama.cpp actually run by default |
|
| 61 |
+
| `emsyai-v2-instruct-f32.gguf` | **v2** base model + LoRA adapter, merged and exported to GGUF | Optional. Legacy 88M architecture |
|
| 62 |
+
| `base_model_154M_step_5000.pt` | Raw PyTorch inference weights | Only if loading it back into the [training code](https://github.com/gulding/EmsyAI) |
|
| 63 |
+
| `tokenizer.json` | The trained 16k-vocab BPE tokenizer | Only needed for the PyTorch path, not GGUF |
|
| 64 |
+
| `Modelfile` | Ollama configuration β prompt template, stop token, temperature | Used automatically by `ollama run` |
|
| 65 |
+
|
| 66 |
+
*(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.)*
|
| 67 |
+
|
| 68 |
+
## Model Details
|
| 69 |
+
|
| 70 |
+
| Specification | EmsyAI-v3 "Titan" (Latest) | EmsyAI-v2 (Legacy) |
|
| 71 |
+
|---|---|---|
|
| 72 |
+
| Parameters | 153.8M (tied embeddings) | 88.1M (tied embeddings) |
|
| 73 |
+
| Layers | 16 | 12 |
|
| 74 |
+
| Hidden dim | 896 | 768 |
|
| 75 |
+
| Attention heads | 14 Query / 2 KV (GQA 7:1) | 12 Query / 4 KV (GQA 3:1) |
|
| 76 |
+
| FFN dim | 2,560 (SwiGLU) | 2,048 (SwiGLU) |
|
| 77 |
+
| Context window | 4,096 tokens | 1,024 tokens |
|
| 78 |
+
| Vocab size | 16,000 (custom BPE) | 16,000 (custom BPE) |
|
| 79 |
+
| Position encoding | RoPE | RoPE |
|
| 80 |
+
|
| 81 |
+
**Training data (V3 Titan):** a ~150M-token hybrid of Cosmopedia v2 (synthetic educational text) and a Python code subset, tokenized with the project's own BPE tokenizer. Strict 10-gram decontamination was run against HumanEval and MBPP. Instruction-tuned with LoRA (rank 8, alpha 16) on ~20k CodeAlpaca examples with masked prompt loss.
|
| 82 |
+
|
| 83 |
+
## Project status
|
| 84 |
+
|
| 85 |
+
**V3 Titan is complete.** The model successfully converged during 5,000 steps of pretraining on the 150M-token corpus, followed by 10,000 steps of LoRA instruction tuning. Prompt loss masking (-100) successfully eliminated base-model "topic drift", resulting in a model that strictly outputs the desired python format.
|
| 86 |
+
|
| 87 |
+
## Limitations
|
| 88 |
+
|
| 89 |
+
- **Small model, small data.** 154M active parameters trained on ~150M tokens β closer in scale to early GPT-2-class experiments than to a modern assistant model.
|
| 90 |
+
- **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.
|
| 91 |
+
- **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.
|
| 92 |
+
- **English only**, and narrow in domain (educational text and Python code).
|
| 93 |
+
|
| 94 |
+
## License
|
| 95 |
+
MIT β see [LICENSE](https://github.com/gulding/EmsyAI/blob/main/LICENSE).
|
| 96 |
+
|
| 97 |
+
## Links
|
| 98 |
+
- π» [Source code, training pipeline, and full docs](https://github.com/gulding/EmsyAI)
|
| 99 |
+
- π¬ [Issues / discussions](https://github.com/gulding/EmsyAI/issues)
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
Prompt loss masking successfully eliminated base-model "topic drift" (the model attempts to output Python blocks rather than continuing the prompt), but the underlying logic is still heavily limited by the 154M parameter count.
|
| 103 |
+
|
| 104 |
+
Here is a raw, unedited transcript from the model demonstrating its capabilities (and limitations):
|
| 105 |
+
|
| 106 |
+
```python
|
| 107 |
+
[USER]
|
| 108 |
+
Write the function def is_prime(n):
|
| 109 |
+
[MODEL]
|
| 110 |
+
def is_prime(n):
|
| 111 |
+
if n <= 1:
|
| 112 |
+
return False
|
| 113 |
+
|
| 114 |
+
for i in range(2, int(n-1)+"):
|
| 115 |
+
print("Fizz")
|
| 116 |
+
```
|
| 117 |
+
*Note: As seen above, while the model attempts to generate Python, it frequently hallucinates syntax errors or drifts into unrelated coding topics (like FizzBuzz).*
|