Skip to content

Out of index problem while attribution #8

Description

@MrZhengXin

[Info] Trained model state loaded.
Traceback (most recent call last):
File "attribution.py", line 204, in
F = attributor.attribute_batch(validation_data,debug=opt.debug)
File "attribution.py", line 85, in attribute_batch
pred = self.model(src_seq, src_pos, tgt_seq, tgt_pos,alpha=k/self.m)
File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 489, in call
result = self.forward(*input, **kwargs)
File "/home/zhengxin/sphinx/OpenNMT-py/torchexplainer/transformer/Models.py", line 218, in forward
enc_output, *_ = self.encoder(src_seq, src_pos,alpha = alpha,return_attns=self.return_attns)
File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 489, in call
result = self.forward(*input, **kwargs)
File "/home/zhengxin/sphinx/OpenNMT-py/torchexplainer/transformer/Models.py", line 91, in forward
enc_output = self.src_word_emb(src_seq) + self.position_enc(src_pos)
File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 489, in call
result = self.forward(*input, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/sparse.py", line 118, in forward
self.norm_type, self.scale_grad_by_freq, self.sparse)
File "/usr/local/lib/python3.5/dist-packages/torch/nn/functional.py", line 1454, in embedding
return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse)
RuntimeError: index out of range at /pytorch/aten/src/TH/generic/THTensorEvenMoreMath.cpp:191

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions