feat: add load_dataset error capture

chore: adjust log detail and LOW_ACCURACY_THRESHOLD
This commit is contained in:
2024-10-07 13:38:34 +08:00
parent 71ad97d48a
commit 742058ded0
2 changed files with 11 additions and 5 deletions
+1 -1
View File
@@ -127,7 +127,7 @@ def main(name, id):
try:
user_func = load_user_function(user_code_file, user_function_name)
except Exception as e:
log_details.append(f"Error loading user function: {e}")
log_details.append(f"加载自定义函数时出错: {e}")
print("\n".join(log_details))
return
+10 -4
View File
@@ -6,7 +6,7 @@ import traceback
EXP_URL = "http://10.2.1.195:880"
PROJECT_NAME = "experiment_knn"
LOW_ACCURACY_THRESHOLD = 0.9
LOW_ACCURACY_THRESHOLD = 0.92
def load_user_function(file_path, function_name):
@@ -122,15 +122,21 @@ def main(name, id):
user_load_dataset = load_user_function(user_code_file, user_load_dataset_name)
user_func = load_user_function(user_code_file, user_function_name)
except Exception as e:
log_details.append(f"Error loading user function: {e}")
log_details.append(f"加载自定义函数时出错: {e}")
print("\n".join(log_details))
return
load_start_time = time.time()
# 加载数据集
train_data, train_labels = user_load_dataset("trainingDigits")
test_data, test_labels = user_load_dataset("testDigits")
try:
train_data, train_labels = user_load_dataset("trainingDigits")
test_data, test_labels = user_load_dataset("testDigits")
except Exception as e:
print(f"加载数据集时出错: {e}")
print("请检查 load_dataset 函数是否正确!")
print("本次评测无效,记录不做提交!")
return
load_end_time = time.time()