"AttributeError: 'Seq2SeqTrainer' object has no attribute 'repo'" after running trainer.push_to_hub()
Just fine-tuned pegasus-large on Google Colab Pro.I create a Seq2SeqTrainer like so:trainer = Seq2SeqTrainer(
    model=model,
    args=args,
    train_dataset=tokenized_datasets["train"],
    eval_dataset=tokenized_datasets["test"],
    data_collator=data_collator,
    tokenizer=tokenizer,
    compute_metrics=compute_metricsAnd after runningtrainer.train(), I execute:!huggingface-cli login
!pip install hf-lfs
!git config --global user.email "jakemsc@example.com"
!git config --global user.name "JakeMSc"
trainer.push_to_hub("test_model")Which then gives this output:Saving model checkpoint to ./results
Configuration saved in ./results/config.json
Model weights saved in ./results/pytorch_model.bin
tokenizer config file saved in ./results/tokenizer_config.json
Special tokens file saved in ./results/special_tokens_map.json
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-21-a676d2b17752> in <module>()
----> 1 trainer.push_to_hub('test-model')

/usr/local/lib/python3.7/dist-packages/transformers/trainer.py in push_to_hub(self, commit_message, **kwargs)
   2513             return
   2514 
-> 2515         return self.repo.push_to_hub(commit_message=commit_message)
   2516 
   2517     #

AttributeError: 'Seq2SeqTrainer' object has no attribute 'repo'System information:transformersversion: 4.8.2Platform: Linux-5.4.104±x86_64-with-Ubuntu-18.04-bionicPython version: 3.7.10PyTorch version (GPU?): 1.9.0+cu102 (True)Tensorflow version (GPU?): 2.5.0 (True)Flax version (CPU?/GPU?/TPU?): not installed (NA)Jax version: not installedJaxLib version: not installedUsing GPU in script?: YesUsing distributed or parallel set-up in script?: NoCan’t see this error being discussed anywhere. Any advice?
2021-07-13T12:50:00Z
hey@JakeMScthis error is a bit odd because it suggests theTrainer.init_git_repofunction is not being called which can only happen ifTrainingArguments.push_to_hubis not set toTrue.in particular, i could not reproduce your error by pushing a seq2seq model to the hub with the official translation tutorial here:Google Colaboratoryperhaps you can also try running the push to hub part of the tutorial notebook in your environment to see if it’s a problem in your configuration?
2021-07-13T14:21:40Z
See solution here:"Dump_all() got an unexpected keyword argument 'sort_keys'" after running trainer.push_to_hub()BeginnersYes, you need to set push_to_hub=True in the training arguments before training. Check theupdated notebooks!