clenaed up gitignore.
Hopefully fixed up another set of cuda errors
This commit is contained in:
parent
58d4736f6d
commit
f41d14075e
8
.gitignore
vendored
8
.gitignore
vendored
@ -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
|
|
@ -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)
|
||||||
|
|
||||||
|
@ -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:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user