HuggingFaceFW/fineweb-edu
Viewer • Updated • 3.5B • 615k • 1.08k
Educational implementation of a 1.1B parameter LLaMA-style Decoder-Only Transformer, pretrained from scratch on FineWeb-Edu.
| Attribute | Value |
|---|---|
| Parameters | ~1.1B |
| Architecture | LLaMA-style (RMSNorm, RoPE, GQA, SwiGLU, Weight Tying) |
| Hidden dim | 2048 |
| Layers | 22 |
| Attention heads | 16 (Q) / 4 (KV) |
| Max sequence length | 2048 |
| Vocab size | 32,000 |
| Training steps | 20,000 |
| Best val loss | 2.3653 (perplexity: 10.65) |
NousResearch/Llama-2-7b-hf, 32K vocab)import torch
from safetensors.torch import load_file
from transformers import AutoTokenizer
# 1. Load config and rebuild model
from llm_lab.config import ModelConfig
from llm_lab.model import LLMModel
model = LLMModel(ModelConfig.base_1b())
state_dict = load_file("model.safetensors")
model.load_state_dict(state_dict, strict=False) # strict=False for weight tying
model.eval()
# 2. Load tokenizer (pretrained LLaMA 2)
tokenizer = AutoTokenizer.from_pretrained("Vjeong/LLM-1B-Lab")
# 3. Generate text
prompt = 'The future of AI is'
input_ids = torch.tensor([tokenizer.encode(prompt)])
output = model.generate(input_ids, max_new_tokens=100, temperature=0.8, top_p=0.9)
print(tokenizer.decode(output[0].tolist()))
Apache 2.0