projects
/
mygpt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added the small-weight embedding initialization.
[mygpt.git]
/
main.py
diff --git
a/main.py
b/main.py
index
bcba9ee
..
b01ea0a
100755
(executable)
--- a/
main.py
+++ b/
main.py
@@
-160,8
+160,8
@@
class TaskPicoCLVR(Task):
def tensorize(self, descr):
token_descr = [ s.strip().split(' ') for s in descr ]
l = max([ len(s) for s in token_descr ])
def tensorize(self, descr):
token_descr = [ s.strip().split(' ') for s in descr ]
l = max([ len(s) for s in token_descr ])
- token_descr = [ [ '<nul>' ] * (l - len(s)) + s for s in token_descr ]
-
#
token_descr = [ s + [ '<nul>' ] * (l - len(s)) for s in token_descr ]
+
#
token_descr = [ [ '<nul>' ] * (l - len(s)) + s for s in token_descr ]
+ token_descr = [ s + [ '<nul>' ] * (l - len(s)) for s in token_descr ]
id_descr = [ [ self.token2id[u] for u in s ] for s in token_descr ]
return torch.tensor(id_descr, device = self.device)
id_descr = [ [ self.token2id[u] for u in s ] for s in token_descr ]
return torch.tensor(id_descr, device = self.device)
@@
-188,6
+188,7
@@
class TaskPicoCLVR(Task):
self.device = device
nb = args.data_size if args.data_size > 0 else 250000
self.device = device
nb = args.data_size if args.data_size > 0 else 250000
+ log_string(f'generating {nb} samples (can take some time)')
self.train_descr = generate_descr((nb * 4) // 5)
self.test_descr = generate_descr((nb * 1) // 5)
self.train_descr = generate_descr((nb * 4) // 5)
self.test_descr = generate_descr((nb * 1) // 5)