Spaces:
Runtime error
Runtime error
Commit
·
6e79f18
1
Parent(s):
25b8856
try probabilistic search
Browse files
app.py
CHANGED
@@ -47,7 +47,8 @@ def respond(custom_string):
|
|
47 |
|
48 |
out = model.out(model.decoder(outputs[:i].unsqueeze(0), e_outputs, src_mask, trg_mask))
|
49 |
out = torch.nn.functional.softmax(out, dim=-1)
|
50 |
-
|
|
|
51 |
|
52 |
outputs[i] = ix[0][0]
|
53 |
if ix[0][0] == vocab_token_dict['<eos>']:
|
|
|
47 |
|
48 |
out = model.out(model.decoder(outputs[:i].unsqueeze(0), e_outputs, src_mask, trg_mask))
|
49 |
out = torch.nn.functional.softmax(out, dim=-1)
|
50 |
+
ix = np.random.choice(np.arange(out), 1, p=out)
|
51 |
+
# val, ix = out[:, -1].data.topk(1)
|
52 |
|
53 |
outputs[i] = ix[0][0]
|
54 |
if ix[0][0] == vocab_token_dict['<eos>']:
|