pythonnlpseq2seq

Where to find a Seq2SeqTrainer to import into project?


Like the title says, I require a Seq2SeqTrainer for my project, but the file/s on Github are not available and return a 404. I use this code to try and import it:

!wget https://raw.githubusercontent.com/huggingface/transformers/master/examples/seq2seq/seq2seq_trainer.py

If it's no longer available anywhere, what would be a good alternative as I want to use ROUGE as well.


Solution

  • I eventually found a solution. The file can be found at: https://github.com/huggingface/transformers/blob/master/examples/legacy/seq2seq/seq2seq_trainer.py

    For some reason when importing the file Python picks up a commented link and throws an error. To get around this simply make a copy of the file without the comments at the top. That worked for me.

    EDIT: I found a neater solution:

    from transformers import Seq2SeqTrainer