Views
No views yet
| Component | Value |
|---|---|
| Vocabulary Size | 104 characters |
| Embedding Dimension | 256 |
| Layers | 6 |
| Attention Heads | 8 |
| Feed-forward Dimension | 1024 |
| Context Window | 128 tokens |
| Dropout | 0.1 |
| Weight Tying | Yes (token embeddings ↔ output layer) |
<PAD>, <UNK>, <BOS>, <EOS>pip install torch safetensors1from safetensors.torch import load_file
2import torch
3import torch.nn as nn
4
5# Load model weights
6state_dict = load_file('model.safetensors')
7
8# Load configuration
9import json
10with open('config.json', 'r') as f:
11 config = json.load(f)
12
13# Note: You'll need to implement the VerySmollGPT architecture
14# or use the original model.py from the repository1# Assuming you have the model loaded
2model.eval()
3
4# Encode your prompt (character-level)
5prompt = "Once upon a time"
6input_ids = [char_to_idx[c] for c in prompt]
7input_tensor = torch.tensor([input_ids], dtype=torch.long)
8
9# Generate
10with torch.no_grad():
11 output_ids = model.generate(
12 input_tensor,
13 max_new_tokens=200,
14 temperature=0.8,
15 top_k=40
16 )
17
18# Decode output
19generated_text = ''.join([idx_to_char[i] for i in output_ids[0].tolist()])
20print(generated_text)Once upon a time, there was a little girl named Lily. She loved to play with her toys and her favorite was a penguin that had a shiny metal box on it. Timmy liked to...
The quick brown fox wanted to play with him again. The fox said he was not fair anymore. He said he was sorry and that he learned his lesson...