projects
/
mygpt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Moved the input/output shift in the forward of the model.
[mygpt.git]
/
mygpt.py
diff --git
a/mygpt.py
b/mygpt.py
index
37fe6af
..
7f0c9e6
100755
(executable)
--- a/
mygpt.py
+++ b/
mygpt.py
@@
-127,10
+127,11
@@
class MyGPT(nn.Module):
self.readout = nn.Linear(in_features = dim_model, out_features = vocabulary_size)
def forward(self, x):
self.readout = nn.Linear(in_features = dim_model, out_features = vocabulary_size)
def forward(self, x):
+ x = torch.cat((x.new_zeros(x.size(0), 1), x), 1)
x = self.embedding(x)
x = self.trunk(x)
x = self.readout(x)
x = self.embedding(x)
x = self.trunk(x)
x = self.readout(x)
- return x
+ return x
[:, :-1]
######################################################################
######################################################################