ChenRocks / ChenRocks/fast_abs_rl

i get an error when I modify the number of layers in LSTM

Open
#24 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
624
Forks
183
PR merge metrics
No merged PRs in 30d

Description

when I modify the number of layers in LSTM and train the train_full_rl.py something wrong;
Start training
Traceback (most recent call last):
File "train_full_rl.py", line 231, in
train(args)
File "train_full_rl.py", line 186, in train
trainer.train()
File "/home/zhangxiaoyi/pyworkspace/bytecup8/fast_abs_rl/training.py", line 211, in train
log_dict = self._pipeline.train_step()
File "/home/zhangxiaoyi/pyworkspace/bytecup8/fast_abs_rl/rl.py", line 193, in train_step
self._stop_reward_fn, self._stop_coeff
File "/home/zhangxiaoyi/pyworkspace/bytecup8/fast_abs_rl/rl.py", line 60, in a2c_train_step
(inds, ms), bs = agent(raw_arts)
File "/home/zhangxiaoyi/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/nn/modules/module.py", line 491, in __call__
result = self.forward(*input, **kwargs)
File "/home/zhangxiaoyi/pyworkspace/bytecup8/fast_abs_rl/model/rl.py", line 221, in forward
outputs = self._ext(enc_art)
File "/home/zhangxiaoyi/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/nn/modules/module.py", line 491, in __call__
result = self.forward(*input, **kwargs)
File "/home/zhangxiaoyi/pyworkspace/bytecup8/fast_abs_rl/model/rl.py", line 130, in forward
self._hop_v, self._hop_wq)
File "/home/zhangxiaoyi/pyworkspace/bytecup8/fast_abs_rl/model/rl.py", line 74, in attention
PtrExtractorRL.attention_score(attention, query, v, w), dim=-1)
File "/home/zhangxiaoyi/pyworkspace/bytecup8/fast_abs_rl/model/rl.py", line 66, in attention_score
sum_ = attention + torch.mm(query, w)
RuntimeError: The size of tensor a (13) must match the size of tensor b (3) at non-singleton dimension 0

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the failure with train_full_rl.py, then inspect model/rl.py at attention_score (line 66) and the surrounding forward path. Compare the tensor dimensions after changing the LSTM layer count; done means training proceeds without the reported size-mismatch error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.