Abhishek Thakur
commited on
Commit
·
90724cf
1
Parent(s):
66d595e
fix eval params
Browse files- competitions/cli/run.py +11 -3
- competitions/info.py +1 -1
- competitions/runner.py +2 -0
competitions/cli/run.py
CHANGED
|
@@ -4,16 +4,24 @@ from . import BaseCompetitionsCommand
|
|
| 4 |
|
| 5 |
|
| 6 |
def run_app_command_factory(args):
|
| 7 |
-
return RunCompetitionsAppCommand()
|
| 8 |
|
| 9 |
|
| 10 |
class RunCompetitionsAppCommand(BaseCompetitionsCommand):
|
| 11 |
@staticmethod
|
| 12 |
def register_subcommand(parser: ArgumentParser):
|
| 13 |
create_project_parser = parser.add_parser("run", description="✨ Run competitions app")
|
|
|
|
|
|
|
| 14 |
create_project_parser.set_defaults(func=run_app_command_factory)
|
| 15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
def run(self):
|
| 17 |
-
|
|
|
|
|
|
|
| 18 |
|
| 19 |
-
|
|
|
|
| 4 |
|
| 5 |
|
| 6 |
def run_app_command_factory(args):
|
| 7 |
+
return RunCompetitionsAppCommand(args)
|
| 8 |
|
| 9 |
|
| 10 |
class RunCompetitionsAppCommand(BaseCompetitionsCommand):
|
| 11 |
@staticmethod
|
| 12 |
def register_subcommand(parser: ArgumentParser):
|
| 13 |
create_project_parser = parser.add_parser("run", description="✨ Run competitions app")
|
| 14 |
+
create_project_parser.add_argument("--host", default="0.0.0.0", help="Host to run app on")
|
| 15 |
+
create_project_parser.add_argument("--port", default=7860, help="Port to run app on")
|
| 16 |
create_project_parser.set_defaults(func=run_app_command_factory)
|
| 17 |
|
| 18 |
+
def __init__(self, args):
|
| 19 |
+
self.host = args.host
|
| 20 |
+
self.port = args.port
|
| 21 |
+
|
| 22 |
def run(self):
|
| 23 |
+
import uvicorn
|
| 24 |
+
|
| 25 |
+
from competitions.app import app
|
| 26 |
|
| 27 |
+
uvicorn.run(app, host=self.host, port=self.port)
|
competitions/info.py
CHANGED
|
@@ -128,7 +128,7 @@ class CompetitionInfo:
|
|
| 128 |
|
| 129 |
@property
|
| 130 |
def hardware(self):
|
| 131 |
-
return self.config
|
| 132 |
|
| 133 |
@property
|
| 134 |
def dataset(self):
|
|
|
|
| 128 |
|
| 129 |
@property
|
| 130 |
def hardware(self):
|
| 131 |
+
return self.config.get("HARDWARE", "cpu-basic")
|
| 132 |
|
| 133 |
@property
|
| 134 |
def dataset(self):
|
competitions/runner.py
CHANGED
|
@@ -37,6 +37,7 @@ class JobRunner:
|
|
| 37 |
self.submission_cols = self.competition_info.submission_cols
|
| 38 |
self.submission_rows = self.competition_info.submission_rows
|
| 39 |
self.time_limit = self.competition_info.time_limit
|
|
|
|
| 40 |
|
| 41 |
def get_pending_subs(self):
|
| 42 |
submission_jsons = snapshot_download(
|
|
@@ -88,6 +89,7 @@ class JobRunner:
|
|
| 88 |
"output_path": self.output_path,
|
| 89 |
"submission_repo": row["submission_repo"],
|
| 90 |
"time_limit": self.time_limit,
|
|
|
|
| 91 |
}
|
| 92 |
eval_params = json.dumps(eval_params)
|
| 93 |
eval_pid = run_evaluation(eval_params, local=True, wait=True)
|
|
|
|
| 37 |
self.submission_cols = self.competition_info.submission_cols
|
| 38 |
self.submission_rows = self.competition_info.submission_rows
|
| 39 |
self.time_limit = self.competition_info.time_limit
|
| 40 |
+
self.dataset = self.competition_info.dataset
|
| 41 |
|
| 42 |
def get_pending_subs(self):
|
| 43 |
submission_jsons = snapshot_download(
|
|
|
|
| 89 |
"output_path": self.output_path,
|
| 90 |
"submission_repo": row["submission_repo"],
|
| 91 |
"time_limit": self.time_limit,
|
| 92 |
+
"dataset": self.dataset,
|
| 93 |
}
|
| 94 |
eval_params = json.dumps(eval_params)
|
| 95 |
eval_pid = run_evaluation(eval_params, local=True, wait=True)
|