feat: add loop_n parameter to the main loop (#611)

* add loop_n parameter to main loop

* complete the loop_n

---------

Co-authored-by: Xu <v-xuminrui@microsoft.com>
This commit is contained in:
Roland Minrui
2025-02-18 19:22:52 +08:00
committed by GitHub
parent 15584bad43
commit 2b89fafa56
2 changed files with 15 additions and 3 deletions
+6 -2
View File
@@ -140,7 +140,7 @@ class DataScienceRDLoop(RDLoop):
logger.log_object(self.trace.sota_experiment(), tag="SOTA experiment")
def main(path=None, step_n=None, competition="bms-molecular-translation"):
def main(path=None, step_n=None, loop_n=None, competition="bms-molecular-translation"):
"""
Parameters
@@ -149,6 +149,10 @@ def main(path=None, step_n=None, competition="bms-molecular-translation"):
path like `$LOG_PATH/__session__/1/0_propose`. It indicates that we restore the state that after finish the step 0 in loop1
step_n :
How many steps to run; if None, it will run forever until error or KeyboardInterrupt
loop_n :
How many loops to run; if None, it will run forever until error or KeyboardInterrupt
- if current loop is incomplete, it will be counted as the first loop for completion.
- if both step_n and loop_n are provided, the process will stop as soon as either condition is met.
competition :
@@ -174,7 +178,7 @@ def main(path=None, step_n=None, competition="bms-molecular-translation"):
kaggle_loop = DataScienceRDLoop(DS_RD_SETTING)
else:
kaggle_loop = DataScienceRDLoop.load(path)
kaggle_loop.run(step_n=step_n)
kaggle_loop.run(step_n=step_n, loop_n=loop_n)
if __name__ == "__main__":