An easy way to make huggingface PRs

Do one time:

wget https://github.com/stas00/git-tools/blob/master/how-to-make-pr/github-make-pr-branch
chmod u+x github-make-pr-branch
sudo cp github-make-pr-branch /usr/bin/

(or put it in your local bin path)

And then any time you want to work on a new huggingface transformers feature, just run:

github-make-pr-branch ssh GITHUB-USERNAME huggingface transformers new-feature

It will:

  1. Fork the project if needed
  2. Set up this fork to track the upstream
  3. Sync your fork to upstream master
  4. Create ‘new-feature’ branch
  5. Set its upstream for an easy push

Now you just need to:

cd transformers-new-feature

do your magic and when ready:

git commit -a
git push

and the PR is ready (just need to go to github and click on PR suggestion to submit)

It, of course, works for any github project.

If this is useful I can make a PR to add instructions to CONTRIBUTING.pm.

This could also be converted in an even simpler script invocation specific to transformers, so it’ll just need:

transformers-pr new-feature

currently it uses an ssh access.

There is also a detailed guide to How to Make a Pull Request (PR).

1 Like

Cool!
Another way is to directly use the github cli.

My own process:

  • Clone repo
    git clone repo_url
  • Create new branch
    git checkout -b feat-add_cool_stuff
  • Regular commits (I do them through VS Code because I like the interface)
  • Send PR with github cli
    gh pr create
3 Likes

Even though I appreciate the effort that you put into this, I agree with boris that the standard git way to do this should be simple enough. If, however, this should be implemented in transformers, it probably should be in the existing transformers-cli directive rather than a separate command.

2 Likes

gh pr status is an incredible command. Tyvm @boris!

2 Likes