File size: 857 Bytes
7de15fc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from pathlib import Path
import torch
import random

PROJECT_ROOT = Path(__file__).resolve().parent.parent
DATA_FILE = str(PROJECT_ROOT / "data" / "ram_altman.txt")
OUTPUT_DIR = str(PROJECT_ROOT / "RAM_Altman_GPT")
END_TOKEN = "<|i_have_enough_ram|>"

TARGET_PARAMS = 100_000
EMBEDDING_SIZE = 40
NUM_LAYERS = 3
NUM_HEADS = 4
VOCAB_SIZE = 640
STEPS = 30000
BATCH_SIZE = 32
LEARNING_RATE = 4e-3

CHAT_TEMPLATE = (
    "{% for message in messages %}"
    "{% if message['role'] == 'user' %}User: {{ message['content'] }}\n"
    "{% elif message['role'] == 'assistant' %}RAM-ALTMAN: {{ message['content'] }}<|i_have_enough_ram|>\n"
    "{% endif %}"
    "{% endfor %}"
    "{% if add_generation_prompt %}RAM-ALTMAN:{% endif %}"
)

DEVICE = "cuda" if torch.cuda.is_available() else "cpu"

def set_seeds(seed=0):
    torch.manual_seed(seed)
    random.seed(seed)