Text Generation
Transformers
Safetensors
GGUF
PyTorch
English
llama
learnllm
fineweb
bpe
from-scratch
text-generation-inference
Instructions to use jaweed123/TinyJLLM with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use jaweed123/TinyJLLM with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="jaweed123/TinyJLLM")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("jaweed123/TinyJLLM") model = AutoModelForCausalLM.from_pretrained("jaweed123/TinyJLLM", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use jaweed123/TinyJLLM 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 jaweed123/TinyJLLM:Q4_K_M # Run inference directly in the terminal: llama cli -hf jaweed123/TinyJLLM:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf jaweed123/TinyJLLM:Q4_K_M # Run inference directly in the terminal: llama cli -hf jaweed123/TinyJLLM:Q4_K_M
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 jaweed123/TinyJLLM:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf jaweed123/TinyJLLM:Q4_K_M
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 jaweed123/TinyJLLM:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf jaweed123/TinyJLLM:Q4_K_M
Use Docker
docker model run hf.co/jaweed123/TinyJLLM:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use jaweed123/TinyJLLM with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "jaweed123/TinyJLLM" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "jaweed123/TinyJLLM", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/jaweed123/TinyJLLM:Q4_K_M
- SGLang
How to use jaweed123/TinyJLLM 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 "jaweed123/TinyJLLM" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "jaweed123/TinyJLLM", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "jaweed123/TinyJLLM" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "jaweed123/TinyJLLM", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Ollama
How to use jaweed123/TinyJLLM with Ollama:
ollama run hf.co/jaweed123/TinyJLLM:Q4_K_M
- Unsloth Desktop
- Docker Model Runner
How to use jaweed123/TinyJLLM with Docker Model Runner:
docker model run hf.co/jaweed123/TinyJLLM:Q4_K_M
- Lemonade
How to use jaweed123/TinyJLLM with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull jaweed123/TinyJLLM:Q4_K_M
Run and chat with the model
lemonade run user.TinyJLLM-Q4_K_M
List all available models
lemonade list
- Atomic Chat
Upload TinyJLLM: 100M SLM pretrained from scratch (3 epochs FineWeb) + GGUF
Browse files- .gitattributes +3 -0
- README.md +88 -0
- config.json +43 -0
- generation_config.json +11 -0
- gguf/learnllm-100m-f16.gguf +3 -0
- gguf/learnllm-100m-q4_k_m.gguf +3 -0
- gguf/learnllm-100m-q8_0.gguf +3 -0
- model.safetensors +3 -0
- tokenizer.json +0 -0
- tokenizer_config.json +23 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,6 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
gguf/learnllm-100m-f16.gguf filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
gguf/learnllm-100m-q4_k_m.gguf filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
gguf/learnllm-100m-q8_0.gguf filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -1,3 +1,91 @@
|
|
| 1 |
---
|
|
|
|
|
|
|
| 2 |
license: mit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
license: mit
|
| 5 |
+
tags:
|
| 6 |
+
- learnllm
|
| 7 |
+
- fineweb
|
| 8 |
+
- pytorch
|
| 9 |
+
- llama
|
| 10 |
+
- bpe
|
| 11 |
+
- from-scratch
|
| 12 |
+
library_name: transformers
|
| 13 |
+
pipeline_tag: text-generation
|
| 14 |
+
base_model: jaweed123/TinyJLLM
|
| 15 |
---
|
| 16 |
+
|
| 17 |
+
# TinyJLLM — 100M-parameter small language model built from scratch
|
| 18 |
+
|
| 19 |
+
A decoder-only Transformer (~102.5M parameters) pretrained **from random
|
| 20 |
+
initialization** on ~5 GB of FineWeb (`sample-10BT`), 3 epochs / 108,000
|
| 21 |
+
optimizer steps. Built as a fully educational pipeline (LearnLLM Run #2):
|
| 22 |
+
custom 32K byte-level BPE tokenizer, from-scratch Transformer, sharded
|
| 23 |
+
uint16 data pipeline, BF16 training, and verified exports.
|
| 24 |
+
|
| 25 |
+
**Final metrics:** validation loss 3.50 (perplexity 33.1); the best
|
| 26 |
+
checkpoint (step 89K) reached 3.48 / 32.6.
|
| 27 |
+
|
| 28 |
+
## Model details
|
| 29 |
+
|
| 30 |
+
| Property | Value |
|
| 31 |
+
|---|---|
|
| 32 |
+
| Parameters | 102,450,432 (~102.5M) |
|
| 33 |
+
| Architecture | Llama-style decoder-only: RMSNorm, RoPE (half-split), SwiGLU, tied embeddings, no biases |
|
| 34 |
+
| Layers / heads / head_dim | 11 / 12 / 64 |
|
| 35 |
+
| Context length | 512 |
|
| 36 |
+
| Vocabulary | 32,000 (custom byte-level BPE, `<pad> <unk> <bos> <eos>` = 0-3) |
|
| 37 |
+
| Pretraining data | FineWeb sample-10BT, ~5.37 GB raw, 1.75M documents |
|
| 38 |
+
| Tokens seen | 3.54B (3 epochs) |
|
| 39 |
+
| Hardware | RTX 4060 8 GB, ~30K tok/s (torch.compile) |
|
| 40 |
+
| Precision | BF16 mixed precision, FP32 master weights |
|
| 41 |
+
|
| 42 |
+
## Intended use
|
| 43 |
+
|
| 44 |
+
- Educational reference: inspect a small, complete, honest pretraining run.
|
| 45 |
+
- Qualitative experimentation: prompt it (it follows prompts *as text*; it
|
| 46 |
+
is a **base model** — no instruction tuning yet).
|
| 47 |
+
- A base for further stages (SFT, DPO, domain fine-tuning).
|
| 48 |
+
|
| 49 |
+
Known limitations: small scale ⇒ repetition in long generations, weak
|
| 50 |
+
instruction following, limited world knowledge.
|
| 51 |
+
|
| 52 |
+
## Usage
|
| 53 |
+
|
| 54 |
+
```python
|
| 55 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 56 |
+
|
| 57 |
+
model = AutoModelForCausalLM.from_pretrained("jaweed123/TinyJLLM")
|
| 58 |
+
tokenizer = AutoTokenizer.from_pretrained("jaweed123/TinyJLLM")
|
| 59 |
+
|
| 60 |
+
prompt = "The future of AI is"
|
| 61 |
+
inputs = tokenizer(prompt, return_tensors="pt")
|
| 62 |
+
out = model.generate(**inputs, max_new_tokens=50, temperature=0.8, top_k=50, top_p=0.95)
|
| 63 |
+
print(tokenizer.decode(out[0]))
|
| 64 |
+
```
|
| 65 |
+
|
| 66 |
+
### llama.cpp / GGUF
|
| 67 |
+
|
| 68 |
+
The repo also ships GGUF files under `gguf/` (F16, Q8_0, Q4_K_M) — load
|
| 69 |
+
directly with llama.cpp or `llama-cpp-python`.
|
| 70 |
+
|
| 71 |
+
## Training details
|
| 72 |
+
|
| 73 |
+
- Custom 32K byte-level BPE (trained on a 512 MB FineWeb sample).
|
| 74 |
+
- Tokens stored once as uint16 shards (591 train + 6 validation).
|
| 75 |
+
- AdamW (lr 3e-4, wd 0.1, decay/no-decay groups), warmup 1,000 + cosine
|
| 76 |
+
to 1e-5, effective batch 64 (32,768 tokens/step), gradient clipping 1.0.
|
| 77 |
+
- Full run: ~35 h on an RTX 4060.
|
| 78 |
+
|
| 79 |
+
## Files
|
| 80 |
+
|
| 81 |
+
- `config.json` — Llama-compatible config (`LlamaForCausalLM`)
|
| 82 |
+
- `model.safetensors` — FP32 weights
|
| 83 |
+
- `tokenizer.json` / `tokenizer_config.json` — custom BPE
|
| 84 |
+
- `generation_config.json` — decoding defaults
|
| 85 |
+
- `gguf/` — llama.cpp formats
|
| 86 |
+
|
| 87 |
+
## Acknowledgments
|
| 88 |
+
|
| 89 |
+
FineWeb (HuggingFaceFW), Hugging Face `tokenizers` / `datasets`,
|
| 90 |
+
PyTorch, llama.cpp. Built with the LearnLLM educational pipeline
|
| 91 |
+
(`src/learnllm` at the project repository).
|
config.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"LlamaForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"model_type": "llama",
|
| 6 |
+
"vocab_size": 32000,
|
| 7 |
+
"max_position_embeddings": 512,
|
| 8 |
+
"hidden_size": 768,
|
| 9 |
+
"intermediate_size": 2048,
|
| 10 |
+
"num_hidden_layers": 11,
|
| 11 |
+
"num_attention_heads": 12,
|
| 12 |
+
"head_dim": 64,
|
| 13 |
+
"rms_norm_eps": 1e-05,
|
| 14 |
+
"rope_theta": 10000.0,
|
| 15 |
+
"tie_word_embeddings": true,
|
| 16 |
+
"hidden_act": "silu",
|
| 17 |
+
"initializer_range": 0.02,
|
| 18 |
+
"bos_token_id": 2,
|
| 19 |
+
"eos_token_id": 3,
|
| 20 |
+
"pad_token_id": 0,
|
| 21 |
+
"torch_dtype": "bfloat16",
|
| 22 |
+
"learnllm": {
|
| 23 |
+
"vocab_size": 32000,
|
| 24 |
+
"context_length": 512,
|
| 25 |
+
"d_model": 768,
|
| 26 |
+
"n_layers": 11,
|
| 27 |
+
"n_heads": 12,
|
| 28 |
+
"head_dim": null,
|
| 29 |
+
"ffn_dim": 2048,
|
| 30 |
+
"dropout": 0.0,
|
| 31 |
+
"bias": false,
|
| 32 |
+
"tie_embeddings": true,
|
| 33 |
+
"norm_type": "rmsnorm",
|
| 34 |
+
"norm_eps": 1e-05,
|
| 35 |
+
"activation": "swiglu",
|
| 36 |
+
"position_encoding": "rope",
|
| 37 |
+
"rope_theta": 10000.0,
|
| 38 |
+
"rope_scaling": null,
|
| 39 |
+
"initializer_range": 0.02,
|
| 40 |
+
"model_type": "llama",
|
| 41 |
+
"architecture_note": "Learned from scratch; parameter names follow the Llama convention so transformers/PEFT/GGUF tools can consume it."
|
| 42 |
+
}
|
| 43 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"max_new_tokens": 100,
|
| 3 |
+
"temperature": 0.8,
|
| 4 |
+
"top_k": 50,
|
| 5 |
+
"top_p": 0.95,
|
| 6 |
+
"bos_token_id": 2,
|
| 7 |
+
"eos_token_id": 3,
|
| 8 |
+
"pad_token_id": 0,
|
| 9 |
+
"model_type": "llama",
|
| 10 |
+
"_learnllm_note": "decoding defaults used by learnllm inference"
|
| 11 |
+
}
|
gguf/learnllm-100m-f16.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2851c42dcbf5f0277316d5a30cb8aad74021dd19aa479f8ed747c01c33dd525a
|
| 3 |
+
size 206064416
|
gguf/learnllm-100m-q4_k_m.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:44987b6d4a83900c5e88cbd255d886fb00730c956934d9d411e86a9a6b5a895f
|
| 3 |
+
size 67940672
|
gguf/learnllm-100m-q8_0.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0a3706ef81d80fdb73f5979425b01edbecff9bcac2afcf71d759aafac82cee92
|
| 3 |
+
size 110033696
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8ee23a4a3c58d0733af9296fbe0a53b59e1adf92749a8c4d476f157715bd164b
|
| 3 |
+
size 409812912
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"tokenizer_class": "PreTrainedTokenizerFast",
|
| 3 |
+
"bos_token": "<bos>",
|
| 4 |
+
"eos_token": "<eos>",
|
| 5 |
+
"unk_token": "<unk>",
|
| 6 |
+
"pad_token": "<pad>",
|
| 7 |
+
"model_max_length": 512,
|
| 8 |
+
"vocab_size": 32000,
|
| 9 |
+
"clean_up_tokenization_spaces": true,
|
| 10 |
+
"_learnllm_meta": {
|
| 11 |
+
"vocab_size": 32000,
|
| 12 |
+
"min_frequency": 2,
|
| 13 |
+
"special_tokens": [
|
| 14 |
+
"<pad>",
|
| 15 |
+
"<unk>",
|
| 16 |
+
"<bos>",
|
| 17 |
+
"<eos>"
|
| 18 |
+
],
|
| 19 |
+
"sample_size_mb": 250.0,
|
| 20 |
+
"seed": 42,
|
| 21 |
+
"save_dir": "J:\\LearnLLM\\models\\tokenizer"
|
| 22 |
+
}
|
| 23 |
+
}
|