# "AttributeError: 'Seq2SeqTrainer' object has no attribute 'repo'" after running trainer.push\_to\_hub()

**URL:** <https://discuss.huggingface.co/t/attributeerror-seq2seqtrainer-object-has-no-attribute-repo-after-running-trainer-push-to-hub/8274>\
**Category:** Beginners\
**Created:** [July 12, 2021, 3:15pm UTC](https://discuss.huggingface.co/t/attributeerror-seq2seqtrainer-object-has-no-attribute-repo-after-running-trainer-push-to-hub/8274 "2021-07-12T15:15:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JakeMSc](https://avatars.discourse-cdn.com/v4/letter/j/ecc23a/32.png) [@JakeMSc](https://discuss.huggingface.co/u/JakeMSc)\
**Post date:** [July 12, 2021, 3:15pm UTC](https://discuss.huggingface.co/t/attributeerror-seq2seqtrainer-object-has-no-attribute-repo-after-running-trainer-push-to-hub/8274/1 "2021-07-12T15:15:12Z")

</div>

Just fine-tuned pegasus-large on Google Colab Pro.

I create a Seq2SeqTrainer like so:

```auto
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_metrics

```

And after running `trainer.train()`, I execute:

```auto
!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:

```auto
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:

- `transformers` version: 4.8.2
- Platform: Linux-5.4.104±x86\_64-with-Ubuntu-18.04-bionic
- Python version: 3.7.10
- PyTorch 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 installed
- JaxLib version: not installed
- Using GPU in script?: Yes
- Using distributed or parallel set-up in script?: No

Can’t see this error being discussed anywhere. Any advice?

---

<div class="post-metadata">

**Author:** ![lewtun](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/lewtun/32/30995_2.png) [@lewtun](https://discuss.huggingface.co/u/lewtun)\
**Post date:** [July 13, 2021, 12:50pm UTC](https://discuss.huggingface.co/t/attributeerror-seq2seqtrainer-object-has-no-attribute-repo-after-running-trainer-push-to-hub/8274/2 "2021-07-13T12:50:00Z")

</div>

hey @JakeMSc

this error is a bit odd because it suggests the `Trainer.init_git_repo` function is not being called which can only happen if `TrainingArguments.push_to_hub` is not set to `True`.

in particular, i could not reproduce your error by pushing a seq2seq model to the hub with the official translation tutorial here: [Google Colaboratory](https://colab.research.google.com/github/huggingface/notebooks/blob/master/examples/translation.ipynb)

perhaps 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?

---

<div class="post-metadata">

**Author:** ![JakeMSc](https://avatars.discourse-cdn.com/v4/letter/j/ecc23a/32.png) [@JakeMSc](https://discuss.huggingface.co/u/JakeMSc)\
**Post date:** [July 13, 2021, 2:21pm UTC](https://discuss.huggingface.co/t/attributeerror-seq2seqtrainer-object-has-no-attribute-repo-after-running-trainer-push-to-hub/8274/3 "2021-07-13T14:21:40Z")

</div>

See solution here:

> [@"Dump\_all() got an unexpected keyword argument 'sort\_keys'" after running trainer.push\_to\_hub()](https://discuss.huggingface.co/t/dump-all-got-an-unexpected-keyword-argument-sort-keys-after-running-trainer-push-to-hub/8269/4):
>
> Yes, you need to set push\_to\_hub=True in the training arguments before training. Check the [updated notebooks](https://huggingface.co/transformers/master/notebooks.html)!
