Text Generation
Transformers
Safetensors
English
mini_llm
mini-llm
from-scratch
small-language-model
conversational
custom_code
Instructions to use GautierP/MiniLLM-150M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use GautierP/MiniLLM-150M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="GautierP/MiniLLM-150M", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("GautierP/MiniLLM-150M", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use GautierP/MiniLLM-150M with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "GautierP/MiniLLM-150M" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "GautierP/MiniLLM-150M", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/GautierP/MiniLLM-150M
- SGLang
How to use GautierP/MiniLLM-150M with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "GautierP/MiniLLM-150M" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "GautierP/MiniLLM-150M", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "GautierP/MiniLLM-150M" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "GautierP/MiniLLM-150M", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use GautierP/MiniLLM-150M with Docker Model Runner:
docker model run hf.co/GautierP/MiniLLM-150M
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -11,9 +11,8 @@ tags:
|
|
| 11 |
# Mini-LLM Assistant 150M
|
| 12 |
|
| 13 |
A ~150M parameter conversational assistant with a full training pipeline implemented
|
| 14 |
-
end-to-end in PyTorch
|
| 15 |
-
pretrained backbone.
|
| 16 |
-
[github.com/Mini-llm-lab/Mini-LLM](https://github.com/Mini-llm-lab/Mini-LLM).
|
| 17 |
|
| 18 |
This repository hosts both the SFT assistant (repository root) and the base model it
|
| 19 |
was fine-tuned from ([`base/`](base)).
|
|
@@ -26,14 +25,14 @@ was fine-tuned from ([`base/`](base)).
|
|
| 26 |
| Architecture | Transformer decoder: RMSNorm, RoPE, causal attention, SwiGLU |
|
| 27 |
| Context length | 512 tokens |
|
| 28 |
| Vocabulary | 32,768 (BPE) |
|
| 29 |
-
| Pretraining | ~4.50B tokens (FineWeb-Edu + Wikipedia), 34,332 steps
|
| 30 |
-
| Fine-tuning | 2 epochs of SFT on Dolly-15k, No Robots, OpenAssistant oasst2, alpaca-cleaned and identity/small-talk examples
|
| 31 |
|
| 32 |
## Base model
|
| 33 |
|
| 34 |
The [`base/`](base) subfolder contains the pretrained checkpoint
|
| 35 |
(`mini-llm-base-150M-34332steps.pt`) before SFT: 152,596,224 parameters, 32,768-token
|
| 36 |
-
BPE vocabulary, ~4.50B tokens (FineWeb-Edu + Wikipedia), 34,332 steps
|
| 37 |
2.941. It is a raw completion model, not an assistant: `base/` ships without a chat
|
| 38 |
template and without the assistant's sampling defaults.
|
| 39 |
|
|
@@ -64,7 +63,7 @@ out = model.generate(inputs, max_new_tokens=128)
|
|
| 64 |
print(tok.decode(out[0][inputs.shape[1]:], skip_special_tokens=True))
|
| 65 |
```
|
| 66 |
|
| 67 |
-
`trust_remote_code=True` is required
|
| 68 |
(`modeling_mini_llm.py`, `configuration_mini_llm.py`). Sampling defaults
|
| 69 |
(temperature 0.5, top_k 40, repetition penalty 1.15) live in `generation_config.json`.
|
| 70 |
|
|
@@ -76,7 +75,7 @@ User: <question>
|
|
| 76 |
Assistant: <answer>
|
| 77 |
```
|
| 78 |
|
| 79 |
-
Each question is processed independently
|
| 80 |
|
| 81 |
## Limitations
|
| 82 |
|
|
@@ -88,4 +87,4 @@ Generation quality is tracked by the
|
|
| 88 |
## Links
|
| 89 |
|
| 90 |
- Base model weights: https://huggingface.co/GautierP/MiniLLM-150M/tree/main/base
|
| 91 |
-
- Code, training pipeline and full documentation: https://github.com/Mini-llm-lab/
|
|
|
|
| 11 |
# Mini-LLM Assistant 150M
|
| 12 |
|
| 13 |
A ~150M parameter conversational assistant with a full training pipeline implemented
|
| 14 |
+
end-to-end in PyTorch: BPE tokenizer, pretraining and supervised fine-tuning, no
|
| 15 |
+
pretrained backbone.
|
|
|
|
| 16 |
|
| 17 |
This repository hosts both the SFT assistant (repository root) and the base model it
|
| 18 |
was fine-tuned from ([`base/`](base)).
|
|
|
|
| 25 |
| Architecture | Transformer decoder: RMSNorm, RoPE, causal attention, SwiGLU |
|
| 26 |
| Context length | 512 tokens |
|
| 27 |
| Vocabulary | 32,768 (BPE) |
|
| 28 |
+
| Pretraining | ~4.50B tokens (FineWeb-Edu + Wikipedia), 34,332 steps, base val loss 2.941 (32k vocabulary) |
|
| 29 |
+
| Fine-tuning | 2 epochs of SFT on Dolly-15k, No Robots, OpenAssistant oasst2, alpaca-cleaned and identity/small-talk examples, val loss 2.780 |
|
| 30 |
|
| 31 |
## Base model
|
| 32 |
|
| 33 |
The [`base/`](base) subfolder contains the pretrained checkpoint
|
| 34 |
(`mini-llm-base-150M-34332steps.pt`) before SFT: 152,596,224 parameters, 32,768-token
|
| 35 |
+
BPE vocabulary, ~4.50B tokens (FineWeb-Edu + Wikipedia), 34,332 steps, base val loss
|
| 36 |
2.941. It is a raw completion model, not an assistant: `base/` ships without a chat
|
| 37 |
template and without the assistant's sampling defaults.
|
| 38 |
|
|
|
|
| 63 |
print(tok.decode(out[0][inputs.shape[1]:], skip_special_tokens=True))
|
| 64 |
```
|
| 65 |
|
| 66 |
+
`trust_remote_code=True` is required, the architecture ships with the repository
|
| 67 |
(`modeling_mini_llm.py`, `configuration_mini_llm.py`). Sampling defaults
|
| 68 |
(temperature 0.5, top_k 40, repetition penalty 1.15) live in `generation_config.json`.
|
| 69 |
|
|
|
|
| 75 |
Assistant: <answer>
|
| 76 |
```
|
| 77 |
|
| 78 |
+
Each question is processed independently, no conversation history is attached.
|
| 79 |
|
| 80 |
## Limitations
|
| 81 |
|
|
|
|
| 87 |
## Links
|
| 88 |
|
| 89 |
- Base model weights: https://huggingface.co/GautierP/MiniLLM-150M/tree/main/base
|
| 90 |
+
- Code, training pipeline and full documentation: https://github.com/Mini-llm-lab/
|