Update.
[culture.git] / mygpt.py
index 809f790..7047849 100755 (executable)
--- a/mygpt.py
+++ b/mygpt.py
@@ -310,9 +310,8 @@ class MyGPT(nn.Module):
                 dist = torch.distributions.categorical.Categorical(logits=logits)
                 t_next = dist.sample()
 
-            if seq_logproba is not None:
-                all_t = torch.arange(t_next.size(0))
-                seq_logproba += logits[all_t, t_next].sum(dim=-1)
+            all_n = torch.arange(t_next.size(0))
+            seq_logproba += logits[all_n, t_next].sum(dim=-1)
 
             input[:, s] = ar_mask[:, s] * t_next + (1 - ar_mask[:, s]) * input[:, s]