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
docs: document the base model in base/
Browse files
README.md
CHANGED
|
@@ -15,8 +15,8 @@ PyTorch — no pretrained weights, no distillation. Tokenizer, pretraining and
|
|
| 15 |
supervised fine-tuning all belong to the
|
| 16 |
[Mini-LLM](https://github.com/Mini-llm-lab/Mini-LLM) project.
|
| 17 |
|
| 18 |
-
This repository
|
| 19 |
-
|
| 20 |
|
| 21 |
## Model details
|
| 22 |
|
|
@@ -29,6 +29,26 @@ base checkpoint (not published).
|
|
| 29 |
| Pretraining | ~4.50B tokens (FineWeb-Edu + Wikipedia), 34,332 steps — base val loss 2.941 (32k vocabulary) |
|
| 30 |
| Fine-tuning | 2 epochs of SFT on Dolly-15k, No Robots, OpenAssistant oasst2, alpaca-cleaned and identity/small-talk examples — val loss 2.780 |
|
| 31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
## Usage
|
| 33 |
|
| 34 |
```python
|
|
@@ -67,4 +87,5 @@ lookup or any production task. English only.
|
|
| 67 |
|
| 68 |
## Links
|
| 69 |
|
|
|
|
| 70 |
- Code, training pipeline and full documentation: https://github.com/Mini-llm-lab/Mini-LLM
|
|
|
|
| 15 |
supervised fine-tuning all belong to the
|
| 16 |
[Mini-LLM](https://github.com/Mini-llm-lab/Mini-LLM) project.
|
| 17 |
|
| 18 |
+
This repository hosts both the SFT assistant (repository root) and the base model it
|
| 19 |
+
was fine-tuned from ([`base/`](base)).
|
| 20 |
|
| 21 |
## Model details
|
| 22 |
|
|
|
|
| 29 |
| Pretraining | ~4.50B tokens (FineWeb-Edu + Wikipedia), 34,332 steps — base val loss 2.941 (32k vocabulary) |
|
| 30 |
| Fine-tuning | 2 epochs of SFT on Dolly-15k, No Robots, OpenAssistant oasst2, alpaca-cleaned and identity/small-talk examples — val loss 2.780 |
|
| 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 — base val loss
|
| 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 |
+
|
| 40 |
+
```python
|
| 41 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 42 |
+
|
| 43 |
+
repo = "GautierP/MiniLLM-150M"
|
| 44 |
+
tok = AutoTokenizer.from_pretrained(repo, subfolder="base", trust_remote_code=True)
|
| 45 |
+
model = AutoModelForCausalLM.from_pretrained(repo, subfolder="base", trust_remote_code=True)
|
| 46 |
+
|
| 47 |
+
inputs = tok("The capital of France is", return_tensors="pt")
|
| 48 |
+
out = model.generate(**inputs, max_new_tokens=64, do_sample=True, temperature=0.8, top_k=50)
|
| 49 |
+
print(tok.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
## Usage
|
| 53 |
|
| 54 |
```python
|
|
|
|
| 87 |
|
| 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/Mini-LLM
|