(Patrick Liu) #1

I use gpu to train my model without any change.
But it shows “TypeError: init() got an unexpected keyword argument ‘sort_within_batch’”

(Patrick Liu) #2

File “”, line 300, in
File “”, line 296, in main
train_model(model, train, valid, fields, optim)
File “”, line 138, in train_model
valid_iter = make_valid_data_iter(valid_data, opt)
File “”, line 114, in make_valid_data_iter
train=False, sort=True)

(Carrot Dude) #3

You might be using an older version of torchtext. Try pull again in your local OpenNMT-py repo, then do pip install -r requirements.txt in your local repo and see if it works. They seem to update the requirements recently.