Clone a repository from a Challenge baseline Algorithm
For Algorithm submission to challenges we recommend cloning the repository of the baseline, if the organizers made one available. As Challenge repositories need to be private, we cannot simply fork the baseline repository, because GitHub doesn't allow it. Instead – before we can start editing – we must clone the baseline, push it to our repository, and clone that repo. Below we outline the steps to this, which we adapted from the Github docs.
First, make sure to have git and git-lfs installed on your local computer, and create a Github account, if you have not already done so.
On GitHub, start by creating a new repository and set it to private. We will call it your-repo
, but pick a name you like. Next, clone the baseline repository in your local bash terminal by running the following commands – but be sure to replace path/to/home
with your desired home path, and replace the URL with the URL of the actual baseline repository +.git
.
$ cd /path/to/home
$ git clone --bare https://github.com/ChallengeOrganizer/algorithm-baseline.git
Then go to the baseline repository folder, push it to your-repo , and (optionally) delete the original:
$ cd algorithm-baseline.git
$ git push --mirror https://github.com/YourUsername/your-repo.git
$ cd ..
$ rm -rf algorithm-baseline.git
Then finally, clone your own repository:
$ git clone https://github.com/YourUsername/your-repo.git
Bring your own Algorithm in inference.py¶
The next step is to bring your algorithm into the inference.py script, by swapping out the baseline algorithm with yours. Perhaps it will be as simple as changing the model definition and copying your model weights to the folder. Most challenges will recommend that you get a local installation of Docker to test and debug locally.
When you're adding files to the algorithm folder, such as model weights, you have to edit the Dockerfile by adding the following line for every additional file:
COPY --chown=algorithm:algorithm checkpoint /opt/algorithm/checkpoint
Replace both instances of checkpoint
with the file path that you need for your Algorithm to run. In addition, any additional dependencies will need to be added to the requirements.txt file with the version number specified, which looks like this:
scikit-learn==1.0
scipy==1.6.3
scikit-image==0.18.1
Commit and push changes to your repository¶
When you're done, commit and push your local repository to your own GitHub repository:
$ cd your-repo.git
$ git add --all
$ git commit -m "First commit to my own Algorithm repo"
$ git push
Note: To be able to add model weights to your repository, you will need to have git-lfs installed. Make sure to follow their getting started instructions, before you run the commands above.
The next step is to link your newly created Github repository to an Algorithm submission. This means that the Algorithm will be built in the cloud by Grand Challenge. Alternatively, you can export the container as a .tar.gz
file with Docker, and upload it.