Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: auto submit result after one kaggle RDLoop #345

Merged
merged 2 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions rdagent/app/kaggle/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,7 @@ class Config:

if_using_feature_selection: bool = False

auto_submit: bool = True


KAGGLE_IMPLEMENT_SETTING = KaggleBasePropSetting()
21 changes: 21 additions & 0 deletions rdagent/app/kaggle/loop.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import subprocess
from collections import defaultdict
from typing import Any

Expand Down Expand Up @@ -79,6 +80,26 @@ def running(self, prev_out: dict[str, Any]):
else:
exp = self.model_runner.develop(prev_out["coding"])
logger.log_object(exp, tag="runner result")

if KAGGLE_IMPLEMENT_SETTING.auto_submit:
csv_path = exp.experiment_workspace.workspace_path / "submission.csv"
try:
subprocess.run(
[
"kaggle",
"competitions",
"submit",
"-f",
str(csv_path.absolute()),
"-m",
str(csv_path.parent.absolute()),
KAGGLE_IMPLEMENT_SETTING.competition,
],
check=True,
)
except subprocess.CalledProcessError as e:
logger.error(f"Auto submission failed: \n{e}")

return exp

skip_loop_error = (ModelEmptyError, FactorEmptyError)
Expand Down
Loading