Skip to content

Commit fe762cd

Browse files
authored
feat: add show_hard_limit option and update time limit handling in DataScience settings (#1144)
1 parent 3c881fe commit fe762cd

File tree

4 files changed

+18
-14
lines changed

4 files changed

+18
-14
lines changed

rdagent/app/data_science/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ class DataScienceBasePropSetting(KaggleBasePropSetting):
126126
coder_longer_timeout_multiplier_upper: int = 3
127127
runner_longer_timeout_multiplier_upper: int = 2
128128
timeout_increase_stage: float = 0.3
129+
show_hard_limit: bool = True
129130

130131
#### hypothesis critique and rewrite
131132
enable_hypo_critique_rewrite: bool = True

rdagent/scenarios/data_science/scen/__init__.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,6 @@ def get_competition_full_desc(self) -> str:
180180
time_limit=None,
181181
recommend_time_limit=None,
182182
eda_output=None,
183-
sample_data_by_LLM=None,
184183
debug_time_limit=None,
185184
recommend_debug_time_limit=None,
186185
runtime_environment=self.get_runtime_environment(),
@@ -198,12 +197,17 @@ def get_scenario_all_desc(self, eda_output=None) -> str:
198197
metric_direction=self.metric_direction,
199198
raw_description=self.raw_description,
200199
use_raw_description=DS_RD_SETTING.use_raw_description,
201-
time_limit=f"{self.real_full_timeout() / 60 / 60 : .2f} hours",
202-
recommend_time_limit=f"{self.recommend_full_timeout() / 60 / 60 : .2f} hours",
200+
time_limit=f"{self.real_full_timeout() / 60 / 60 : .2f} hours" if DS_RD_SETTING.show_hard_limit else None,
201+
recommend_time_limit=(
202+
f"{self.recommend_full_timeout() / 60 / 60 : .2f} hours" if DS_RD_SETTING.sample_data_by_LLM else None
203+
),
203204
eda_output=eda_output,
204-
sample_data_by_LLM=DS_RD_SETTING.sample_data_by_LLM,
205-
debug_time_limit=f"{self.real_debug_timeout() / 60 : .2f} minutes",
206-
recommend_debug_time_limit=f"{self.recommend_debug_timeout() / 60 : .2f} minutes",
205+
debug_time_limit=(
206+
f"{self.real_debug_timeout() / 60 : .2f} minutes" if DS_RD_SETTING.show_hard_limit else None
207+
),
208+
recommend_debug_time_limit=(
209+
f"{self.recommend_debug_timeout() / 60 : .2f} minutes" if DS_RD_SETTING.sample_data_by_LLM else None
210+
),
207211
runtime_environment=self.get_runtime_environment(),
208212
)
209213

rdagent/scenarios/data_science/scen/prompts.yaml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,20 @@ scenario_description: |-
3434
{{ evaluation }}
3535
{% endif %}
3636
37-
{% if time_limit %}
37+
{% if time_limit is not none %}
3838
====== Time Limit On Full Code Execution ======
3939
Your full code's execution is limited to **{{ time_limit }}**. After this time limit, your code will be terminated and all time and resources are wasted. Always make sure your code will not run longer than this time limit.
4040
During this time limit, you have all the resources available to you. Please fully leverage all the computational resources(CPUs and GPUs) to achieve the best performance like choose a powerful model, use a large batch size, enable data sampler with big parallel.
41-
{% if sample_data_by_LLM is not none and sample_data_by_LLM is true %}
41+
{% endif %}{% if debug_time_limit is not none%}
4242
====== Time Limit On Debug Mode Code Execution ======
4343
Your are also required to include a debug mode in your code, the debug code's execution is limited to **{{ debug_time_limit }}**. You should make sure 10 percent of the data training one epoch can be finished within this time limit. If not, your should propose a new debug strategy in your task.
44-
{% endif %}
44+
{% endif %}{% if recommend_time_limit is not none %}
4545
====== Recommend Time Spent On Full Code Execution ======
4646
You should always prioritize performance over time spent since some tasks requires very little time to run the code to achieve the best performance while some tasks might need a lot of time to train one or more large models.
47-
We recommend you to spend less than **{{ recommend_time_limit }}** on the full code execution to boost efficiency. This is a recommended time limit, you can spend more time on the code execution if you think it is necessary. But always remember to not exceed the time limit.
48-
{% if sample_data_by_LLM is not none and sample_data_by_LLM is true %}
47+
We recommend you to spend less than **{{ recommend_time_limit }}** on the full code execution to boost efficiency. This is a recommended time limit, you can spend more time on the code execution if you think it is very necessary. But your code could be terminated sometime after this recommend time limit.
48+
{% endif %}{% if recommend_debug_time_limit is not none %}
4949
====== Recommend Time Spent On Debug Mode Code Execution ======
50-
We recommend you to spend less than **{{ recommend_debug_time_limit }}** on the debug mode code execution to boost efficiency. This is a recommended time limit, you can spend more time on the debug mode code execution if you think it is necessary. But always remember to not exceed the time limit.
51-
{% endif %}
50+
We recommend you to spend less than **{{ recommend_debug_time_limit }}** on the debug mode code execution to boost efficiency. This is a recommended time limit, you can spend more time on the debug mode code execution if you think it is very necessary. But your code could be terminated sometime after this recommend time limit.
5251
{% endif %}
5352
5453
{% if runtime_environment is not none %}

rdagent/utils/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def filter_redundant_text(stdout: str) -> str:
127127
for line in filtered_stdout_lines:
128128
lines_to_count[line] = lines_to_count.get(line, 0) + 1
129129
filtered_stdout = "\n".join(
130-
[line for line in filtered_stdout_lines if lines_to_count[line] <= len(filtered_stdout_lines) // 10]
130+
[line for line in filtered_stdout_lines if lines_to_count[line] <= max(len(filtered_stdout_lines) // 10, 10)]
131131
)
132132

133133
# Iteratively ask the LLM for additional filtering patterns (up to 3 rounds)

0 commit comments

Comments
 (0)