Instructions to use Duoia/duogpt-40m-v1 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 Duoia/duogpt-40m-v1 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 Duoia/duogpt-40m-v1:F16 # Run inference directly in the terminal: llama cli -hf Duoia/duogpt-40m-v1:F16
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf Duoia/duogpt-40m-v1:F16 # Run inference directly in the terminal: llama cli -hf Duoia/duogpt-40m-v1:F16
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 Duoia/duogpt-40m-v1:F16 # Run inference directly in the terminal: ./llama-cli -hf Duoia/duogpt-40m-v1:F16
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 Duoia/duogpt-40m-v1:F16 # Run inference directly in the terminal: ./build/bin/llama-cli -hf Duoia/duogpt-40m-v1:F16
Use Docker
docker model run hf.co/Duoia/duogpt-40m-v1:F16
- LM Studio
- Jan
- vLLM
How to use Duoia/duogpt-40m-v1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Duoia/duogpt-40m-v1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Duoia/duogpt-40m-v1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Duoia/duogpt-40m-v1:F16
- Ollama
How to use Duoia/duogpt-40m-v1 with Ollama:
ollama run hf.co/Duoia/duogpt-40m-v1:F16
- Unsloth Desktop
- Docker Model Runner
How to use Duoia/duogpt-40m-v1 with Docker Model Runner:
docker model run hf.co/Duoia/duogpt-40m-v1:F16
- Lemonade
How to use Duoia/duogpt-40m-v1 with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull Duoia/duogpt-40m-v1:F16
Run and chat with the model
lemonade run user.duogpt-40m-v1-F16
List all available models
lemonade list
- Atomic Chat
DuoGPT-40M (Gen 1)
A 38.85M-parameter English small language model trained from scratch on a single consumer GPU (RTX 4060 Laptop 8GB).
| Parameters | 38,854,144 (bf16 โ 78MB) |
| Architecture | Llama-style: 11 layers / d512 / 8 heads / SwiGLU / RoPE / RMSNorm, no bias, tied embeddings |
| Vocabulary | 8192 (custom byte-level BPE) |
| Context | 512 tokens |
| Pretraining | 745M tokens, 3.37h, val ppl 4.96 |
| SFT | 334K samples (summarization + write-a-story-by-words), 2.07h, val ppl 2.99 |
GGUF / Ollama Usage
This repo also ships GGUF weights (converted directly from model/lit_model.pth, template kept identical to training), ready to import into Ollama:
# Pull a GGUF from HF (pick a quantization level)
curl -L -o duogpt-40m.gguf \
https://huggingface.co/Duoia/duogpt-40m-v1/resolve/main/duogpt-40m-v1-q4_k_m.gguf
# Import with the Modelfile in this repo
ollama create duogpt-40m -f Modelfile
ollama run duogpt-40m "Where is Mary?"
| File | Size | Notes |
|---|---|---|
duogpt-40m-v1-q4_k_m.gguf |
36 MB | Recommended for daily use (Q4_K_M quantized) |
duogpt-40m-v1-f16.gguf |
83 MB | Unquantized, best quality |
Modelfile |
- | Ollama import config (template matches training format) |
The GGUF build behaves like the litgpt version's
/q /s /tcommands: the template bakes in the<|user|>wrapper, soollama run duogpt-40m "<question>"is equivalent to the old/qcommand.
Quick Start
pip install -r requirements.txt # mainly litgpt==0.5.13 + torch
bash scripts/chat.sh # interactive chat (loads the SFT model by default)
bash scripts/ask.sh "Summarize the following story in one sentence." # one-shot ask
If
python3is not the interpreter with the installed dependencies, specify it withPYTHON=/path/to/python bash scripts/chat.sh.
The three question modes in scripts/chat.sh:
/q <question> bare question
/s <story> | <question> reading comprehension with a short story
/t <instruction> | <input> any task (summarize, write a story, etc.)
Contents
model/ SFT version (recommended for daily use; writes stories / summarizes / simple Q&A)
src/duogpt_prompt.py required chat-template class (litgpt looks it up on load; PYTHONPATH is set by the scripts)
scripts/chat.sh interactive entry (auto-points at the model in this package)
scripts/ask.sh one-shot ask entry
scripts/chat.py implementation of chat.sh (load once, ask repeatedly)
MODEL_CARD.md full model card: architecture/param distribution, data composition, training hyperparams, eval numbers
Usage Examples
# Explicit tasks (what the model is best at)
bash scripts/ask.sh "Write a short story for young children using these words: moon, basket, tiny"
bash scripts/ask.sh "Summarize the following story in one or two sentences.
Once upon a time, there was a little girl named Lily. She found a shiny red ball."
# Switch model / tune params
TEMP=0.3 MAXTOK=40 bash scripts/chat.sh
Directly in Python:
from litgpt import LLM
llm = LLM.load("model") # auto-reads the package's prompt_style
print(llm.generate("Summarize the following story in one sentence.\nOnce upon a time...",
max_new_tokens=60, temperature=0.7))
Known Limitations (important, avoid misjudging)
- Only does assigned tasks: give it a bare question (e.g.
What is a volcano?) and it won't answer; you must spell out the task explicitly as above. - No knowledge: the training corpus is children's stories only; factual questions get made up.
- 512-token context cap: prompt + generated length combined; exceeding it raises
Cannot forward sequence of length T. - Drifts as it writes: a common issue at 39M scale โ later parts of long text lose coherence (entity mixing, repetition).
- English-only, children's-level vocabulary.
Data Sources & License
- Pretraining corpus: TinyStoriesV2-GPT4 (CDLA-Sharing-1.0) and Children-Stories (user-provided, includes GPT-generated content).
- Model weights in this package were trained from scratch on the above data for research/personal use; if redistributing, please keep this notice and MODEL_CARD.md.
- Downloads last month
- 25
4-bit
16-bit