You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
for batch_idx, batch in enumerate(train_iter):
opt.zero_grad()
all_logits, all_labels = [], []
fold = torchfold.Fold(device=device)
# TODO: incorrect logic here, the for loop goes through the entire dataset, not the batch:
for example in batch.dataset:
The line for example in batch.dataset: does not iterate though a batch. Instead, it iterates through an entire training set. This means that the fold code after the loop will not run until after the entire training set is scanned.
If I accumulate up to batch_size examples to test the fold code after the loop, I get an exception:
File "/Users/fac2003/PycharmProjects/torchfold/examples/snli/spinn-example.py", line 54, in leaf
embedded = self.embeddings(word_id)
File "/Users/fac2003/pytorch_env/lib/python3.6/site-packages/torch/nn/modules/module.py", line 491, in call
result = self.forward(*input, **kwargs)
File "/Users/fac2003/pytorch_env/lib/python3.6/site-packages/torch/nn/modules/sparse.py", line 108, in forward
self.norm_type, self.scale_grad_by_freq, self.sparse)
File "/Users/fac2003/pytorch_env/lib/python3.6/site-packages/torch/nn/functional.py", line 1076, in embedding
return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse)
RuntimeError: index out of range at /Users/soumith/code/builder/wheel/pytorch-src/aten/src/TH/generic/THTensorMath.c:343
Presumably, the word id is larger than the max number of words. This is likely a consequence of initializing the tree with a non vectorized example. I am wondering why the torchtext tensors in batch are not used instead (they have the correct batch dimensionality).
The text was updated successfully, but these errors were encountered:
fac2003
added a commit
to CampagneLaboratory/torchfold
that referenced
this issue
Aug 2, 2018
The SPINN example reads:
The line for example in batch.dataset: does not iterate though a batch. Instead, it iterates through an entire training set. This means that the fold code after the loop will not run until after the entire training set is scanned.
If I accumulate up to batch_size examples to test the fold code after the loop, I get an exception:
File "/Users/fac2003/PycharmProjects/torchfold/examples/snli/spinn-example.py", line 54, in leaf
embedded = self.embeddings(word_id)
File "/Users/fac2003/pytorch_env/lib/python3.6/site-packages/torch/nn/modules/module.py", line 491, in call
result = self.forward(*input, **kwargs)
File "/Users/fac2003/pytorch_env/lib/python3.6/site-packages/torch/nn/modules/sparse.py", line 108, in forward
self.norm_type, self.scale_grad_by_freq, self.sparse)
File "/Users/fac2003/pytorch_env/lib/python3.6/site-packages/torch/nn/functional.py", line 1076, in embedding
return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse)
RuntimeError: index out of range at /Users/soumith/code/builder/wheel/pytorch-src/aten/src/TH/generic/THTensorMath.c:343
Presumably, the word id is larger than the max number of words. This is likely a consequence of initializing the tree with a non vectorized example. I am wondering why the torchtext tensors in batch are not used instead (they have the correct batch dimensionality).
The text was updated successfully, but these errors were encountered: