Transformers: RAG finetuning - unexpected keyword argument 'early_stop_callback'

Created on 14 Oct 2020  路  2Comments  路  Source: huggingface/transformers

Environment info

transformers version: 3.3.1
Platform: Ubuntu
Python version:3.6.12
PyTorch version (GPU: yes): 1.6.0
Using GPU in script?: 1 gpu
Using distributed or parallel set-up in script?: no

Who can help

@patrickvonplaten @sgugger

Information

model name: facebook/rag-token-base

The problem arises when using:

  • [x ] the official example scripts: (give details below)

The tasks I am working on is:

  • [x ] my own task or dataset: (give details below)

To reproduce

Call finetune ona rag model
python examples/rag/finetune.py --data_dir=$(pwd)/examples/rag/ioannis-data --output_dir $(pwd)/examples/rag/ioannis-output --model_name_or_path=facebook/rag-token-base --model_type rag_sequence --fp16 --gpus 1

Traceback (most recent call last):
  File "examples/rag/finetune.py", line 469, in <module>
    main(args)
  File "examples/rag/finetune.py", line 442, in main
    logger=logger,
  File "/home/ioannis/Desktop/transformers/examples/lightning_base.py", line 379, in generic_train
    **train_params,
  File "/home/ioannis/anaconda3/envs/transformers/lib/python3.6/site-packages/pytorch_lightning/trainer/properties.py", line 122, in from_argparse_args
    return argparse_utils.from_argparse_args(cls, args, **kwargs)
  File "/home/ioannis/anaconda3/envs/transformers/lib/python3.6/site-packages/pytorch_lightning/utilities/argparse_utils.py", line 50, in from_argparse_args
    return cls(**trainer_kwargs)
  File "/home/ioannis/anaconda3/envs/transformers/lib/python3.6/site-packages/pytorch_lightning/trainer/connectors/env_vars_connector.py", line 41, in overwrite_by_env_vars
    return fn(self, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'early_stop_callback'

I noticed a variable named early_stopping_callback in finetune.py. A typo perhaps?

Most helpful comment

If you don't need early stopping just comment out early_stop_callback=early_stopping_callback on line 379 of /home/ioannis/Desktop/transformers/examples/lightning_base.py. You should be able to run your script.

I think lightning may have changed their api
You can also just uninstall your pytorch lightning and do pip install pytorch_lightning==0.9.0 and script should work

All 2 comments

If you don't need early stopping just comment out early_stop_callback=early_stopping_callback on line 379 of /home/ioannis/Desktop/transformers/examples/lightning_base.py. You should be able to run your script.

I think lightning may have changed their api
You can also just uninstall your pytorch lightning and do pip install pytorch_lightning==0.9.0 and script should work

Awesome! Installing 0.9.0 worked.

I manually installed pytorch_lightning and gitpython as they were not included in the transformers installation and the rag requirements file.

Was this page helpful?
0 / 5 - 0 ratings