Abhishek Thakur
commited on
Commit
·
8998a09
1
Parent(s):
0c9be38
docs
Browse files- competitions/cli/create.py +39 -2
- docs/source/_toctree.yml +4 -1
- docs/source/getting_started.mdx +15 -1
- docs/source/index.mdx +11 -0
- docs/source/pricing.mdx +9 -0
competitions/cli/create.py
CHANGED
@@ -1,6 +1,9 @@
|
|
1 |
from argparse import ArgumentParser
|
2 |
|
3 |
from . import BaseCompetitionsCommand
|
|
|
|
|
|
|
4 |
|
5 |
|
6 |
def create_command_factory(args):
|
@@ -14,6 +17,40 @@ class CreateCompetitionAppCommand(BaseCompetitionsCommand):
|
|
14 |
create_project_parser.set_defaults(func=create_command_factory)
|
15 |
|
16 |
def run(self):
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
from argparse import ArgumentParser
|
2 |
|
3 |
from . import BaseCompetitionsCommand
|
4 |
+
import click
|
5 |
+
from loguru import logger
|
6 |
+
from huggingface_hub import HfApi
|
7 |
|
8 |
|
9 |
def create_command_factory(args):
|
|
|
17 |
create_project_parser.set_defaults(func=create_command_factory)
|
18 |
|
19 |
def run(self):
|
20 |
+
competition_name_text = "Competition name. Must be unqiue and contain only letters, numbers & hypens."
|
21 |
+
competition_name = click.prompt(competition_name_text, type=str)
|
22 |
+
competition_name = competition_name.lower().replace(" ", "-")
|
23 |
+
competition_name = competition_name.replace("_", "-")
|
24 |
+
competition_name = competition_name.replace(".", "-")
|
25 |
+
competition_name = competition_name.replace("/", "-")
|
26 |
+
competition_name = competition_name.replace("\\", "-")
|
27 |
+
competition_name = competition_name.replace(":", "-")
|
28 |
+
competition_name = competition_name.replace(";", "-")
|
29 |
+
competition_name = competition_name.replace(",", "-")
|
30 |
+
competition_name = competition_name.replace("!", "-")
|
31 |
+
competition_name = competition_name.replace("?", "-")
|
32 |
+
competition_name = competition_name.replace("'", "-")
|
33 |
+
competition_name = competition_name.replace('"', "-")
|
34 |
+
competition_name = competition_name.replace("`", "-")
|
35 |
+
competition_name = competition_name.replace("~", "-")
|
36 |
+
competition_name = competition_name.replace("@", "-")
|
37 |
+
competition_name = competition_name.replace("#", "-")
|
38 |
+
logger.info(f"Creating competition: {competition_name}")
|
39 |
|
40 |
+
org_choices = HfApi().organization_list()
|
41 |
+
competition_org_text = "Competition organization. Choose one of {org_choices}"
|
42 |
+
competition_org = click.prompt(competition_org_text, type=str)
|
43 |
+
if competition_org not in org_choices:
|
44 |
+
raise ValueError(f"Organization {competition_org} not found in {org_choices}")
|
45 |
+
|
46 |
+
competition_type_text = "Competition type. Choose one of 'generic', 'script'"
|
47 |
+
competition_type = click.prompt(competition_type_text, type=str)
|
48 |
+
if competition_type not in ["generic", "script"]:
|
49 |
+
raise ValueError(f"Competition type {competition_type} not found in ['generic', 'script']")
|
50 |
+
if competition_type == "script":
|
51 |
+
time_limit = click.prompt("Time limit in seconds", type=int)
|
52 |
+
else:
|
53 |
+
time_limit = 10
|
54 |
+
|
55 |
+
hardware_choices = ["cpu-free", "gpu-free", "tpu-free"]
|
56 |
+
hardware_text = "Hardware. Choose one of {hardware_choices}"
|
docs/source/_toctree.yml
CHANGED
@@ -2,4 +2,7 @@
|
|
2 |
- local: index
|
3 |
title: 🤗 Competitions
|
4 |
- local: getting_started
|
5 |
-
title:
|
|
|
|
|
|
|
|
2 |
- local: index
|
3 |
title: 🤗 Competitions
|
4 |
- local: getting_started
|
5 |
+
title: Getting started
|
6 |
+
- local: pricing
|
7 |
+
title: Pricing
|
8 |
+
|
docs/source/getting_started.mdx
CHANGED
@@ -1 +1,15 @@
|
|
1 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Getting started
|
2 |
+
|
3 |
+
## Installation
|
4 |
+
|
5 |
+
```bash
|
6 |
+
pip install competitions
|
7 |
+
```
|
8 |
+
|
9 |
+
## Creating a competition
|
10 |
+
|
11 |
+
```bash
|
12 |
+
competitions create
|
13 |
+
```
|
14 |
+
|
15 |
+
Then follow the prompts.
|
docs/source/index.mdx
CHANGED
@@ -1 +1,12 @@
|
|
1 |
# Competitions
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
# Competitions
|
2 |
+
|
3 |
+
Create a machine learning competition for your organization, friends or the world!
|
4 |
+
|
5 |
+
There are two types of competitions you can create:
|
6 |
+
|
7 |
+
- generic: a competition where you provide the data and the participants provide the predictions as a CSV file. all the test data is always available to the participants.
|
8 |
+
|
9 |
+
- script: a competition where you provide the data and the participants provide the code that generates the predictions. test data can be hidden from the participants.
|
10 |
+
|
11 |
+
You can choose to make your competition public or private. Public competitions are visible to everyone and anyone can participate. Private competitions are only visible to the people you invite!
|
12 |
+
|
docs/source/pricing.mdx
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Pricing
|
2 |
+
|
3 |
+
Creating a competition is free. However, you will need to pay for the compute resources used to run the competition. The cost of the compute resources depends the type of competition you create.
|
4 |
+
|
5 |
+
- generic: generic competitions are free to run. you can, however, upgrade the compute to cpu-basic to speed up the metric calculation and reduce the waiting time for the participants.
|
6 |
+
|
7 |
+
- script: script competitions require a compute resource to run the participant's code. you can choose between a variety of cpu and gpu instances (T4, A10g and even A100). the cost of the compute resource is charged per hour.
|
8 |
+
|
9 |
+
For information on the cost of the compute resources, please see the [pricing page](https://huggingface.co/docs/hub/spaces-overview#hardware-resources).
|