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
|
@@ -12,26 +12,28 @@ tags:
|
|
| 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 (
|
| 23 |
|
| 24 |
### Built from scratch:
|
| 25 |
-
-
|
| 26 |
- π **Rotary position embeddings (RoPE)** via complex tensor rotation
|
| 27 |
-
-
|
| 28 |
-
-
|
| 29 |
-
-
|
| 30 |
- πΎ **KV caching** for autoregressive inference
|
| 31 |
-
-
|
| 32 |
|
| 33 |
## Quickstart
|
| 34 |
|
|
|
|
|
|
|
| 35 |
```bash
|
| 36 |
ollama run hf.co/gulding/EmsyAI
|
| 37 |
```
|
|
@@ -41,7 +43,7 @@ or with `llama.cpp`:
|
|
| 41 |
llama-cli -hf gulding/EmsyAI:F32
|
| 42 |
```
|
| 43 |
|
| 44 |
-
> **Note:**
|
| 45 |
|
| 46 |
## Prompt format
|
| 47 |
|
|
@@ -55,7 +57,8 @@ Write a Python function to check if a number is prime.
|
|
| 55 |
|
| 56 |
| File | What it is | Do you need it? |
|
| 57 |
|---|---|---|
|
| 58 |
-
| `emsyai-v3-titan-instruct-f32.gguf` | v3 base model + LoRA adapter, merged and exported to GGUF | **Yes.** This is what Ollama / llama.cpp actually run |
|
|
|
|
| 59 |
| `base_model_154M_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` |
|
|
@@ -64,40 +67,26 @@ Write a Python function to check if a number is prime.
|
|
| 64 |
|
| 65 |
## Model Details
|
| 66 |
|
| 67 |
-
| Specification | EmsyAI-
|
| 68 |
|---|---|---|
|
| 69 |
-
| Parameters |
|
| 70 |
-
| Layers |
|
| 71 |
-
| Hidden dim |
|
| 72 |
-
| Attention heads |
|
| 73 |
-
| FFN dim | 2,
|
| 74 |
-
| Context window |
|
| 75 |
| Vocab size | 16,000 (custom BPE) | 16,000 (custom BPE) |
|
| 76 |
| Position encoding | RoPE | RoPE |
|
| 77 |
|
| 78 |
-
**Training data (
|
| 79 |
|
| 80 |
## Project status
|
| 81 |
|
| 82 |
-
|
| 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.**
|
| 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).
|
|
@@ -107,4 +96,4 @@ 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 |
-
-
|
|
|
|
| 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 |
```
|
|
|
|
| 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 |
|
|
|
|
| 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` |
|
|
|
|
| 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).
|
|
|
|
| 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)
|