Repository
Last updated
Last updated
The BOINC AI Hub is a collection of git repositories. is a widely used tool in software development to easily version projects when working collaboratively. This guide will show you how to interact with the repositories on the Hub, especially:
Create and delete a repository.
Manage branches and tags.
Rename your repository.
Update your repository visibility.
Manage a local copy of your repository.
If you are used to working with platforms such as GitLab/GitHub/Bitbucket, your first instinct might be to use git
CLI to clone your repo (git clone
), commit changes (git add, git commit
) and push them (git push
). This is valid when using the BOINC AI Hub. However, software engineering and machine learning do not share the same requirements and workflows. Model repositories might maintain large model weight files for different frameworks and tools, so cloning the repository can lead to you maintaining large local folders with massive sizes. As a result, it may be more efficient to use our custom HTTP methods. You can read our explanation page for more details.
If you want to create and manage a repository on the Hub, your machine must be logged in. If you are not, please refer to . In the rest of this guide, we will assume that your machine is logged in.
The first step is to know how to create and delete repositories. You can only manage repositories that you own (under your username namespace) or from organizations in which you have write permissions.
Create an empty repository with and give it a name with the repo_id
parameter. The repo_id
is your namespace followed by the repository name: username_or_org/repo_name
.
Copied
Copied
When you create a repository, you can set your repository visibility with the private
parameter.
Copied
Specify the repo_id
of the repository you want to delete:
Copied
Copied
Now that you have created your repository, you are interested in pushing changes to it and downloading files from it.
Copied
Copied
Repositories come with some settings that you can configure. Most of the time, you will want to do that manually in the repo settings page in your browser. You must have write access to a repo to configure it (either own it or being part of an organization). In this section, we will see the settings that you can also configure programmatically using boincai_hub
.
A repository can be public or private. A private repository is only visible to you or members of the organization in which the repository is located. Change a repository to private as shown in the following:
Copied
Copied
All the actions described above can be done using HTTP requests. However, in some cases you might be interested in having a local copy of your repository and interact with it using the Git commands you are familiar with.
Copied
The clone_from
parameter clones a repository from a BOINC AI repository ID to a local directory specified by the local_dir
argument:
Copied
clone_from
can also clone a repository using a URL:
Copied
Copied
You can also configure a Git username and email to a cloned repository by specifying the git_user
and git_email
parameters when you clone a repository. When users commit to that repository, Git will be aware of the commit author.
Copied
Copied
Copied
Set rebase=True
if you want your local commits to occur after your branch is updated with the new commits from the remote:
Copied
By default, creates a model repository. But you can use the repo_type
parameter to specify another repository type. For example, if you want to create a dataset repository:
If you want to change the repository visibility at a later time, you can use the function.
Delete a repository with . Make sure you want to delete a repository because this is an irreversible process!
In some cases, you want to copy someone elseβs repo to adapt it to your use case. This is possible for Spaces using the method. It will duplicate the whole repository. You will still need to configure your own settings (hardware, sleep-time, storage, variables and secrets). Check out our guide for more details.
These 2 topics deserve their own guides. Please refer to the and the guides to learn how to use your repository.
Git repositories often make use of branches to store different versions of a same repository. Tags can also be used to flag a specific state of your repository, for example, when releasing a version. More generally, branches and tags are referred as .
You can create new branch and tags using and :
You can use the and functions in the same way to delete a branch or a tag.
You can also list the existing git refs from a repository using :
Some settings are specific to Spaces (hardware, environment variables,β¦). To configure those, please refer to our guide.
You can rename your repository on the Hub using . Using this method, you can also move the repo from a user to an organization. When doing so, there are a that you should be aware of. For example, you canβt transfer your repo to another user.
The class allows you to interact with files and repositories on the Hub with functions similar to Git commands. It is a wrapper over Git and Git-LFS methods to use the Git commands you already know and love. Before starting, please make sure you have Git-LFS installed (see for installation instructions).
Instantiate a object with a path to a local repository:
You can combine the clone_from
parameter with to create and clone a repository:
Branches are important for collaboration and experimentation without impacting your current files and code. Switch between branches with . For example, if you want to switch from branch1
to branch2
:
allows you to update a current local branch with changes from a remote repository: