question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Enable branch to be specified in `Repository.push_to_hub`

See original GitHub issue

As a user, I would like to be able to push my repo’s files to a specific branch on the Hub, e.g.

my_repo = Repository(...)

# create some local files, e.g. save a model

my_repo.push_to_hub(commit_message="I love Git!", branch="my-awesome-branch")

This would be quite useful for the evaluation / benchmarking projects where the current idea (due to @lhoestq) is to store the model predictions for task X in a separate branch on a single repo. (We store the predictions for reproducibility purposes)

I’m not sure if Repository.push_to_hub is the right entry point for this feature or whether it makes sense to have something like Repository.git_checkout

cc @SBrandeis @thomwolf @abhishekkrthakur

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
LysandreJikcommented, Aug 12, 2021

I’m taking care of it in the branch-push-to-hub branch!

1reaction
LysandreJikcommented, Aug 9, 2021

Do you think that the constructor should also support something like this (be it optional revision parameter or allowing to have the revision in the url of clone_from)? That way if your workflow is in a branch you can do this without much issues.

You mean something like the following:

from huggingface_hub import Repository

repo = Repository("xxx", clone_from="xxx/yyy", revision="zzz")
# or
repo = Repository("xxx", clone_from="xxx/yyy@zzz")

This would essentially be a clone + checkout, or did you envision it a different way?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Changing the default branch - GitHub Docs
If you have more than one branch in your repository, you can configure any branch as ... You can set the name of...
Read more >
Set Git branch security and permissions - Azure Repos
Use the branches view to configure security. Open the Branches page by navigating to your project in the web portal and selecting Repos, ......
Read more >
Getting Started with Repositories - Hugging Face
This document shows how to handle repositories through the web interface as well as through the terminal. There are no requirements if working...
Read more >
docker push - Docker Documentation
Use docker image push to share your images to the Docker Hub registry or to a self-hosted one. Refer to the docker image...
Read more >
Configure git to use 'main' as the primary branch
Overview When you initialize a new git repository via SSH on a DreamHost server, the primary branch is named master. This is because...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found