Views
No views yet

| Benchmark | Score | What it means |
|---|---|---|
| WikiText-2 (Perplexity) | 81.49 | The model successfully learned standard English grammar, syntax, and punctuation structure. (Lower is better). |
| SciQ (Accuracy) | 35.20% | The model can accurately retrieve basic scientific facts (biology, chemistry) above the 25% random-chance baseline. |
| MMLU (Accuracy) | 23.09% | Expected for this size. The model is too small to memorize college-level law and physics, effectively acting as random chance (~25%). |
model.py architecture script (included in this repository), you don't load it using the standard transformers library pipeline. Instead, download the files from this repo and use the provided PyTorch script.1import torch
2import tiktoken
3import json
4from model import GPTModel
5from safetensors.torch import load_file
6
7# 1. Load Config
8with open("config.json") as f:
9 cfg = json.load(f)
10
11# 2. Instantiate Model
12model = GPTModel(cfg)
13
14# 3. Load Safetensors
15state_dict = load_file("model.safetensors")
16model.load_state_dict(state_dict, strict=False)
17model.cuda()
18model.eval()
19
20# 4. Tokenizer
21tokenizer = tiktoken.get_encoding("gpt2")
22eot_token_id = tokenizer.encode("<|endoftext|>", allowed_special={"<|endoftext|>"})[0]
23
24# 5. Inference
25prompt = (
26 "Below is an instruction that describes a task. "
27 "Write a response that appropriately completes the request.\n\n"
28 "### Instruction:\nWhat is the capital of France?\n\n### Response:\n"
29)
30
31input_ids = torch.tensor(tokenizer.encode(prompt)).unsqueeze(0).cuda()
32generated = []
33
34with torch.no_grad():
35 for _ in range(100):
36 logits = model(input_ids)
37 next_token_logits = logits[:, -1, :]
38
39 # Repetition Penalty
40 penalty = 1.2
41 for token_id in set(generated):
42 if next_token_logits[0, token_id] < 0:
43 next_token_logits[0, token_id] *= penalty
44 else:
45 next_token_logits[0, token_id] /= penalty
46
47 next_token_id = torch.argmax(next_token_logits, dim=-1).unsqueeze(0)
48
49 if next_token_id.item() == eot_token_id:
50 break
51
52 generated.append(next_token_id.item())
53 input_ids = torch.cat([input_ids, next_token_id], dim=-1)
54
55print(tokenizer.decode(generated))1.2, the model generates highly coherent text and follows instructions surprisingly well for its size:How can I stay motivated to exercise?
- Set realistic goals and stick to them. This will help you feel more confident in your fitness level, which can lead to better results.
- Practice mindfulness meditation or yoga regularly. Mindfulness meditation helps reduce stress levels and improve overall well-being.
- Take breaks throughout the day to recharge and focus on your breath.
- Exercise regularly. Regular physical activity can help boost energy levels and increase muscle mass.
- Get enough sleep each night. Sleep is essential for maintaining good health and reducing stress levels.
- Seek professional advice from a healthcare provider if you have any concerns about your fitness level.