Skip to content

Commit

Permalink
fix a bug in kaggle runner cache and kaggle costeer execute template (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
WinstonLiyt authored Nov 4, 2024
1 parent db2511a commit 83b3f78
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 0 additions & 2 deletions docs/scens/kaggle_agent.rst
Original file line number Diff line number Diff line change
Expand Up @@ -240,5 +240,3 @@ The following environment variables can be set in the `.env` file to customize t
:members: coder_use_cache, data_folder, data_folder_debug, file_based_execution_timeout, select_method, select_threshold, max_loop, knowledge_base_path, new_knowledge_base_path
:exclude-members: Config, fail_task_trial_limit, v1_query_former_trace_limit, v1_query_similar_success_limit, v2_query_component_limit, v2_query_error_limit, v2_query_former_trace_limit, v2_error_summary, v2_knowledge_sampler, v2_add_fail_attempt_to_latest_successful_execution, new_knowledge_base_path, knowledge_base_path, data_folder, data_folder_debug, select_threshold
:no-index:


Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ valid_X = pd.DataFrame(np.random.randn(8, 30), columns=[f"{i}" for i in range(30
valid_y = pd.Series(np.random.randint(0, 2, 8))

model = fit(train_X, train_y, valid_X, valid_y)
execution_model_output = predict(model, valid_X).cpu().detach().numpy()
execution_model_output = predict(model, valid_X)
if isinstance(execution_model_output, torch.Tensor):
execution_model_output = execution_model_output.cpu().detach().numpy()

execution_feedback_str = f"Execution successful, output numpy ndarray shape: {execution_model_output.shape}"

Expand Down
3 changes: 2 additions & 1 deletion rdagent/scenarios/kaggle/developer/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ def get_cache_key(self, exp: ASpecificExp) -> str:
for f in sorted((exp.experiment_workspace.workspace_path / "model").glob("*.py"), key=lambda x: x.name):
codes.append(f.read_text())
codes = "\n".join(codes)
for i in range(len(exp.sub_workspace_list)):
codes += str(exp.sub_workspace_list[i].code_dict.values())
return md5_hash(codes)

@cache_with_pickle(get_cache_key, CachedRunner.assign_cached_result)
Expand Down Expand Up @@ -58,7 +60,6 @@ def develop(self, exp: KGModelExperiment) -> KGModelExperiment:
else:
model_file_name = f"model/model_{model_type.lower()}.py"
exp.experiment_workspace.inject_code(**{model_file_name: sub_ws.code_dict["model.py"]})

env_to_use = {"PYTHONPATH": "./"}

result = exp.experiment_workspace.execute(run_env=env_to_use)
Expand Down

0 comments on commit 83b3f78

Please sign in to comment.