clenaed up gitignore.

Hopefully fixed up another set of cuda errors
This commit is contained in:
Dani 2025-04-28 23:07:18 -04:00
parent 58d4736f6d
commit f41d14075e
3 changed files with 12 additions and 8 deletions

8
.gitignore vendored
View File

@ -170,9 +170,5 @@ cython_debug/
.vscode/launch.json .vscode/launch.json
/data/books/* /data/books/*
/data/memory/context.json /data/memory/*
/data/memory/dreams.json /data/logs/*
data/memory/brainmap.json
/data/memory/vocab.json
data/memory/book_progress.json
/data/memory/journal.json

View File

@ -13,14 +13,20 @@ recent_dreams = []
def daydream(): def daydream():
model.eval() model.eval()
seed = torch.tensor([random.randint(0, tokenizer.next_id - 1)], device=DEVICE).unsqueeze(0) max_token_id = model.head.out_features - 1
seed = torch.randint(0, max_token_id + 1, (1, 1), device=DEVICE)
dream = [] dream = []
max_token_id = model.head.out_features - 1
for _ in range(12): for _ in range(12):
out = model(seed) out = model(seed)
logits = out[:, -1, :] logits = out[:, -1, :]
probs = F.softmax(logits, dim=-1) probs = F.softmax(logits, dim=-1)
token = torch.multinomial(probs, num_samples=1) token = torch.multinomial(probs, num_samples=1)
# CLAMP the token
token = torch.clamp(token, max=max_token_id)
dream.append(token.item()) dream.append(token.item())
seed = torch.cat([seed, token], dim=1) seed = torch.cat([seed, token], dim=1)

View File

@ -47,7 +47,9 @@ def train_on_message(text: str, source: str = "user"):
# Clamp any token IDs beyond the model's output size # Clamp any token IDs beyond the model's output size
max_token_id = model.head.out_features - 1 max_token_id = model.head.out_features - 1
tokens = [min(t, max_token_id) for t in tokens] if tokenizer.next_id > model.head.out_features:
expand_model_if_needed()
tokens = [t if t <= max_token_id else max_token_id for t in tokens]
tokens = tokens[:128] # Hard clamp input length tokens = tokens[:128] # Hard clamp input length
if len(tokens) < 2: if len(tokens) < 2: