fix a bug in kaggle runner cache and kaggle costeer execute template (#467)

This commit is contained in:
WinstonLiyt
2024-11-04 11:16:16 +08:00
committed by GitHub
parent fb7aa0d257
commit 437fbcb577
3 changed files with 5 additions and 4 deletions
-2
View File
@@ -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:
@@ -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}"
+2 -1
View File
@@ -25,6 +25,8 @@ class KGCachedRunner(CachedRunner[ASpecificExp]):
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)
@@ -58,7 +60,6 @@ class KGModelRunner(KGCachedRunner[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)