gonito/templates/challenge-how-to.hamlet
2021-10-09 14:44:37 +02:00

218 lines
8.0 KiB
Plaintext

<h1>Challenge How To
<h2>Install GEval (recommended, but not obligatory)
<p>In order to evaluate your work locally, you need the GEval tool. There are two ways to get it.
<h4>option A — just download the GEval fully static binary (simpler if you have a standard 64-bit Linux)
<pre>
wget <a href="https://gonito.net/get/bin/geval">https://gonito.net/get/bin/geval</a>
chmod u+x geval
./geval --help
<h4>option B — install GEval with Haskell Stack (needs some time and a couple of gigabytes of hard disk space)
<p>First, install <a href="https://docs.haskellstack.org/en/stable/README/">Haskell Stack</a>:
<pre>
curl -sSL https://get.haskellstack.org/ | sh
<p>and then install GEval itself:
<pre>
git clone git://gonito.net/geval
cd geval
stack setup
stack install
~/.local/bin/geval --help
<p>For troubleshooting, see <a href="https://gitlab.com/filipg/geval#installing">GEval readme</a>.
<p>(GEval will make your life easier, but is not obligatory, so if you have any trouble with installing/running GEval, you can skip this step, for the time being.)
<h2>Get your repo
$case (appRepoScheme settings)
$of SelfHosted
$if (not isIDSet || not isSSHUploaded) && isNothing mAltRepoScheme
<p>You need to
$if not isIDSet
\ set up your ID
$if not isSSHUploaded
\ and
$if not isSSHUploaded
\ upload your SSH public key
\ (see <a href="@{YourAccountR}">your account</a>) if you want to have a repo hosted on this instance, then:
$maybe altRepoScheme <- mAltRepoScheme
<p>(Depending on your setup, you might need to create the repo at your git server first; remember to initiate it without any commits!)
<pre>
git clone #{altRepoScheme}#{challengeName challenge}
$nothing
<pre>
git clone --single-branch #{appRepoHost settings}#{shownId}/#{challengeName challenge}
# --single-branch was used to speed up the process, but now we need to fix remote branches
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
<p>(Warning about empty repository is expected, don't worry about it.)
$maybe altRepoScheme <- mAltRepoScheme
^{externalRepoInfo settings}
<pre>
cd #{challengeName challenge}
git pull #{repoUrl repo}
$if isNothing mAltRepoScheme
<h4>Using an external repository
<p>Alternatively, you can use any other Git repo, e.g. GitLab, GitHub or your own repo.
^{externalRepoInfo settings}
$of NoInternalGitServer
$maybe altRepoScheme <- mAltRepoScheme
<p>Make sure the repo #{altRepoScheme}#{challengeName challenge} exists. Note that it should be created as empty (do <em>not</em> create any default `README.md` file).
$nothing
<p>You need to have a repo at some external Git server (e.g. GitHub, GitLab or your own git server) for storing your solution.
<p>Create a repo at your server. It should be created as empty (do **not** create any default `README.md` file).
<p>The repo should contain <tt>#{challengeName challenge}</tt> as part of its URL (preferably it should be the last part of the URL)
^{externalRepoInfo settings}
<pre>
$maybe altRepoScheme <- mAltRepoScheme
git clone #{altRepoScheme}#{challengeName challenge}
$nothing
git clone URL_TO_YOUR_REPO
<pre>
cd #{challengeName challenge}
git pull #{repoUrl repo}
$of Branches
<p>Clone the repo:
<pre>
git clone --single-branch #{repoUrl repo}
# --single-branch was used to speed up the process, but now we need to fix remote branches
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
$maybe gitAnnexRemote <- (repoGitAnnexRemote repo)
<pre>
git annex init
git annex initremote storage #{gitAnnexRemote}
git annex get --from storage
<h2>Work on your solution
<p>You need to generate your solution for the test set as <tt>test-A/out.tsv</tt>. It is also recommended to generate the output for the dev set (<tt>dev-0/out.tsv</tt>).
<p>You can evaluate results for the dev set locally:
<pre>
cd #{challengeName challenge}
geval --test-name dev-0
<h2>Push your solution to the git repo
<p>Commit and push <tt>out.tsv</tt> files to your repo. It is also recommended to push your source codes along with <tt>out.tsv</tt> files.
<pre>
cd #{challengeName challenge}
git checkout -b #{myBranch} # switch to some other branch
git add foo.py build.sh # add your source codes
git add gonito.yaml # it's a good practice to add metadata file, see below
$if isJust (repoGitAnnexRemote repo)
<pre>
# if your output files are large or if they should not pushed to the regular repo (e.g. contain sensitive information):
git annex add dev-0/out.tsv test-A/out.tsv
git annex copy --to storage
# otherwise (e.g. they are just class labels), add the output files in a regular manner:
git add dev-0/out.tsv test-A/out.tsv
$else
<pre>
git add dev-0/out.tsv test-A/out.tsv # add your output files
<pre>
git commit -m 'my brilliant solution'
$case (appRepoScheme settings)
$of SelfHosted
<pre>
git push origin #{myBranch}
<h2>Submit your solution to Gonito
<h3>Repos hosted on this instance
<p>If you use a repo hosted here, a submission and evaluation is triggered automatically. You'll see the evaluation results in your console while pushing.
$of _
<pre>
git push origin #{myBranch}
<h2>Submit your solution to Gonito
<h3>Integration with external repos
<p>If you use an external repo (e.g. at your own of Gitolite or at GitLab/GitHub), you can configure a webhook.
$maybe token <- mToken
<p>Your webook is:
<pre>
wget --timeout=0 --quiet -O - '#{appRoot settings}/trigger-remotely' --post-data 'token=#{token}&branch=#{myBranch}&challenge=#{challengeName challenge}&url=#{urlToYourRepo}'
<p>or you can just use the following URL:
<pre>
#{appRoot settings}/trigger-remotely-simple/#{token}/#{challengeName challenge}/#{urlToYourRepo}/#{myBranch}
<h3>Manual submission
<p>In case other methods fail, you can submit your solution manually — go to the <a href="@{ChallengeSubmissionR $ challengeName challenge}">submit form</a>.
<h2>Submission metadata
<p>Gonito can take the metadata (description, tags, parameters) of a submission from a number of sources (in order of precedence):
<ol>
<li>the YAML files specified in the <tt>param-files</tt> field of the <tt>gonito.yaml</tt> file
<ul>
<li>only applicable for parameters,
<li><tt>gonito.yaml</tt> will be always skipped even if matches a mask given in the <tt>param-files</tt> field,
<li>parameters blacklisted in the <tt>unwanted-params</tt> field of the <tt>gonito.yaml</tt> file will be discarded;
<li><tt>gonito.yaml</tt> file committed to the repository
<ul>
<li>description given in the <tt>description</tt> field,
<li>tags given in <tt>tags</tt> field,
<li>parameters given in <tt>params</tt> field,
<li>names of output files (only for parameters)
<ul>
<li>e.g. if the output file is <tt>out-epochs=10,learning-rate=0.01.tsv</tt>, then parameters <i>epochs</i>=10 and <i>learning-rare</i>=0.01 will be extracted;
<li>submission form (when submitting manually);
<li>git commit message
<ul>
<li>description taken from the first paragraph
<li>tags taken from a line starting with <tt>tags:</tt>
<p>Here is an example of <tt>gonito.yaml</tt>, in which all metadata could be given (note that you can also add links to external resources using the `links` section):
<pre>
description: This my brilliant solution
tags:
\ - neural-network
\ - left-to-right
params:
\ epochs: 10
\ learning-rate: 0.01
unwanted-params:
\ - model-file
\ - vocab-file
param-files:
\ - "*.yaml"
\ - config/*.yaml
links:
\ - title: "Some external link"
\ url: "https://example.com/foo-bar-baz-123"
\ - title: "Yet another link"
\ url: "https://example.org/xyz"
\ - url: "https://example.net/bare-link-without-text"
<p>It might seem a little bit complicated, but you could simply use the method which is the most convenient for you.