Sort_within_batch?

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

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

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.