Skip to content

'Tensor' object has no attribute 'flip' #1

Description

@ronsoohyeong

Hi
I tried to train "Word level Penn Treebank (PTB) with LSTM"

./train_span.sh MODEL_FILE_NAME

Pytorch version is 0.4.0 and python 3.6.6.
But it has error as follows:

Args: Namespace(alpha=2, batch_size=20, beta=1, bptt=70, clip=0.25, cuda=True, data='data/penn', dropout=0.4, dropoute=0.1, dropouth=0.25, dropouti=0.4, emsize=400, epochs=800, log_interval=200, lr=30, model='LSTM', nhid=1150, nlayers=3, nonmono=5, ns=True, optimizer='sgd', resume='', save='ptb_lstm.pt', seed=141, theta=0.5, tied=True, wdecay=1.2e-06, wdrop=0.5, when=[-1])
Model total parameters: 24221600
Traceback (most recent call last):
  File "main_span.py", line 344, in <module>
    train()
  File "main_span.py", line 217, in train
    data, targets, targets_r = get_batch(train_data, i, args, seq_len=seq_len)
  File "/home/me/PILM/utils.py", line 30, in get_batch
    target_r = source[i:i-1+seq_len].flip([0]).view(-1)
AttributeError: 'Tensor' object has no attribute 'flip'

Can you please check whether pytorch 0.4 is the correct requirement?

Thanks in advance
Ron

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