transformers icon indicating copy to clipboard operation
transformers copied to clipboard

trainer.push_to_hub(**kwargs) requires "git pull" first

Open Yiiii19 opened this issue 2 years ago • 2 comments

System Info

Hi, I am using the Segformer, following the tutorial https://huggingface.co/blog/fine-tune-segformer Everytime aftern training the conflict error will come after executing the code "trainer.push_to_hub(**kwargs)". Error messages: ! [rejected] main -> main (fetch first) error: failed to push some refs to 'https://huggingface.co/yiming19/segformer-b0-finetuned-segments-construction-1' hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caused by another repository pushing hint: to the same ref. You may want to first integrate the remote changes hint: (e.g., 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.

I could use git pull and git push manually to push model, but why will this error come or before push the model can execute git pull first? @sgugger

Thanks.

Who can help?

No response

Information

  • [ ] The official example scripts
  • [ ] My own modified scripts

Tasks

  • [ ] An officially supported task in the examples folder (such as GLUE/SQuAD, ...)
  • [ ] My own task or dataset (give details below)

Reproduction

kwargs = { "tags": ["vision", "image-segmentation"], "finetuned_from": pretrained_model_name, "dataset": hf_dataset_identifier, }

feature_extractor.push_to_hub(hub_model_id) trainer.push_to_hub(**kwargs)

Expected behavior

I just follow the tutorial https://huggingface.co/blog/fine-tune-segformer Should no error come.

Yiiii19 avatar Mar 16 '23 09:03 Yiiii19

You either need to --overwrite_output_dir or make sure the output_dir you are using is a local clone of your repo that is up to date, yes.

sgugger avatar Mar 16 '23 12:03 sgugger

Thanks to your fast reply. How could I change the code? Cause I donot want to pull and push in the terminal manually, want to do "pull" firstly then "push" in the code example provided by the link.

Yiiii19 avatar Mar 16 '23 13:03 Yiiii19

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

github-actions[bot] avatar Apr 15 '23 15:04 github-actions[bot]