prajdabre / yanmtt

Yet Another Neural Machine Translation Toolkit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RuntimeError: The expanded size of the tensor (22) must match the existing size (21) at non-singleton dimension 1. Target sizes: [178, 22, 1] . Tensor sizes: [178, 21, 1]

Ab26 opened this issue · comments

error log:

Training from scratch
/home/bhandari1/.local/lib/python3.6/site-packages/torch/optim/lr_scheduler.py:216: UserWarning: Please also save or load the state of the optimizer when saving or loading the scheduler.
warnings.warn(SAVE_STATE_WARNING, UserWarning)
/home/bhandari1/.local/lib/python3.6/site-packages/torch/optim/lr_scheduler.py:234: UserWarning: Please also save or load the state of the optimizer when saving or loading the scheduler.
warnings.warn(SAVE_STATE_WARNING, UserWarning)
Using label smoothing of 0.1
Using gradient clipping norm of 1.0
Using softmax temperature of 1.0
Masking ratio: 0.3
Training for: ['hi']
Shuffling corpus!
Finished epoch 1 for language: hi
Shuffling corpus!
Finished epoch 2 for language: hi
Shuffling corpus!
Finished epoch 3 for language: hi
Shuffling corpus!
Finished epoch 4 for language: hi
Shuffling corpus!
Finished epoch 5 for language: hi
Shuffling corpus!
Saving the model
Loading from checkpoint
Traceback (most recent call last):
File "pretrain_nmt.py", line 990, in
run_demo()
File "pretrain_nmt.py", line 987, in run_demo
mp.spawn(model_create_load_run_save, nprocs=args.gpus, args=(args,files,train_files)) #
File "/home/bhandari1/.local/lib/python3.6/site-packages/torch/multiprocessing/spawn.py", line 199, in spawn
return start_processes(fn, args, nprocs, join, daemon, start_method='spawn')
File "/home/bhandari1/.local/lib/python3.6/site-packages/torch/multiprocessing/spawn.py", line 157, in start_processes
while not context.join():
File "/home/bhandari1/.local/lib/python3.6/site-packages/torch/multiprocessing/spawn.py", line 118, in join
raise Exception(msg)
Exception:

-- Process 0 terminated with the following error:
Traceback (most recent call last):
File "/home/bhandari1/.local/lib/python3.6/site-packages/torch/multiprocessing/spawn.py", line 19, in wrap
fn(i, *args)
File "/home/bhandari1/yanmtt/pretrain_nmt.py", line 535, in model_create_load_run_save
lprobs, labels, args.label_smoothing, ignore_index=tok.pad_token_id
File "/home/bhandari1/yanmtt/common_utils.py", line 147, in label_smoothed_nll_loss
smooth_loss.masked_fill
(pad_mask, 0.0)
RuntimeError: The expanded size of the tensor (22) must match the existing size (21) at non-singleton dimension 1. Target sizes: [178, 22, 1]
. Tensor sizes: [178, 21, 1]