Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

torch.nn.modules.module.ModuleAttributeError: 'Graph2Tree' object has no attribute 'in_pad_token' #18

Closed
liamjxu opened this issue Apr 27, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@liamjxu
Copy link

liamjxu commented Apr 27, 2022

Code version: 8779d0d
Command line (generated by https://mwptoolkit.readthedocs.io/en/latest/_static/cmd.html):

python run_mwptoolkit.py --model=Graph2Tree --dataset=asdiv-a --task_type=single_equation --gpu_id=0 --equation_fix=prefix

Error Message:

Traceback (most recent call last):
  File "run_mwptoolkit.py", line 26, in <module>
    run_toolkit(args.model, args.dataset, args.task_type, config_dict)
  File "/data/MWPToolkit/mwptoolkit/quick_start.py", line 215, in run_toolkit
    train_with_train_valid_test_split(config)
  File "/data/MWPToolkit/mwptoolkit/quick_start.py", line 103, in train_with_train_valid_test_split
    trainer.fit()
  File "/data/MWPToolkit/mwptoolkit/trainer/supervised_trainer.py", line 532, in fit
    loss_total, train_time_cost = self._train_epoch()
  File "/data/MWPToolkit/mwptoolkit/trainer/supervised_trainer.py", line 515, in _train_epoch
    batch_loss = self._train_batch(batch)
  File "/data/MWPToolkit/mwptoolkit/trainer/supervised_trainer.py", line 476, in _train_batch
    batch_loss = self.model.calculate_loss(batch)
  File "/data/MWPToolkit/mwptoolkit/model/Graph2Tree/graph2tree.py", line 161, in calculate_loss
    group_nums, target, output_all_layers=True)
  File "/data/MWPToolkit/mwptoolkit/model/Graph2Tree/graph2tree.py", line 105, in forward
    seq_mask = torch.eq(seq, self.in_pad_token).to(self.device)
  File "/data/anaconda3/envs/number/lib/python3.7/site-packages/torch/nn/modules/module.py", line 779, in __getattr__
    type(self).__name__, name))
torch.nn.modules.module.ModuleAttributeError: 'Graph2Tree' object has no attribute 'in_pad_token'
@LYH-YF
Copy link
Owner

LYH-YF commented Apr 27, 2022

it seems an error in v0.0.6, sorry about that.

@LYH-YF LYH-YF added the bug Something isn't working label Apr 27, 2022
@liamjxu
Copy link
Author

liamjxu commented Apr 28, 2022

Thanks for the prompt resolution!

@liamjxu liamjxu closed this as completed Apr 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants