unilm icon indicating copy to clipboard operation
unilm copied to clipboard

E5 model finetune error.

Open wangyiran33 opened this issue 2 years ago • 2 comments
trafficstars

Describe I'm fintuning the released E5 model intfloat/multilingual-e5-base using simlm/scripts/train_biencoder_marco.sh. Error happens during evalution after training one epoch:

Traceback (most recent call last):
  File "src/train_biencoder.py", line 101, in <module>
    main()
  File "src/train_biencoder.py", line 80, in main
    train_result = trainer.train()
  File "python3.8/site-packages/transformers/trainer.py", line 1645, in train
    return inner_training_loop(
  File "python3.8/site-packages/transformers/trainer.py", line 2035, in _inner_training_loop
    self._maybe_log_save_evaluate(tr_loss, model, trial, epoch, ignore_keys_for_eval)
  File "python3.8/site-packages/transformers/trainer.py", line 2321, in _maybe_log_save_evaluate
    metrics = self.evaluate(ignore_keys=ignore_keys_for_eval)
  File "python3.8/site-packages/transformers/trainer.py", line 3053, in evaluate
    output = eval_loop(
  File "python3.8/site-packages/transformers/trainer.py", line 3245, in evaluation_loop
    loss, logits, labels = self.prediction_step(model, inputs, prediction_loss_only, ignore_keys=ignore_keys)
  File "python3.8/site-packages/transformers/trainer.py", line 3513, in prediction_step
    outputs = model(**inputs)
  File "python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
TypeError: forward() got an unexpected keyword argument 'q_input_ids'

To ensure that the issue does not occur in my dataset, I switched to msmarco_bm25_official dataset and the only code i modified is --model_name_or_path in train_biencoder_marco.sh which I pointed to the path downloaded from huggingface. but the same error still persists. I suspect that it is caused by inconsistent tokenizers.

Looking forward to your response.

wangyiran33 avatar Jul 10 '23 08:07 wangyiran33

Can you try adding --label_names labels to the launch command in simlm/scripts/train_biencoder_marco.sh?

Our code base is tested with transformers==4.15, newer versions seem to have breaking changes for us.

UPDATE: this issue is fixed in the latest commit https://github.com/microsoft/unilm/commit/414d5295fa69d1a6aae4e99a4294ffb436453de4 Please let me know if you still see this error.

intfloat avatar Jul 10 '23 10:07 intfloat

Can you try adding --label_names labels to the launch command in simlm/scripts/train_biencoder_marco.sh?

Our code base is tested with transformers==4.15, newer versions seem to have breaking changes for us.

UPDATE: this issue is fixed in the latest commit 414d529 Please let me know if you still see this error.

yes it works! https://github.com/microsoft/unilm/commit/414d5295fa69d1a6aae4e99a4294ffb436453de4 works for me transformers==4.30.2. Thanks a lot!

wangyiran33 avatar Jul 10 '23 11:07 wangyiran33