71 lines
2.0 KiB
Python
71 lines
2.0 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
简单调试脚本
|
|
"""
|
|
import sys
|
|
import os
|
|
|
|
# 添加server路径
|
|
server_path = os.path.join(os.path.dirname(__file__), 'server')
|
|
sys.path.append(server_path)
|
|
|
|
print("=== 简单调试测试 ===")
|
|
|
|
# 1. 测试基本导入
|
|
print("1. 测试基本导入...")
|
|
try:
|
|
import pandas as pd
|
|
print("OK pandas导入成功")
|
|
except Exception as e:
|
|
print(f"ERROR pandas导入失败: {e}")
|
|
|
|
try:
|
|
import torch
|
|
print("OK torch导入成功")
|
|
except Exception as e:
|
|
print(f"ERROR torch导入失败: {e}")
|
|
|
|
# 2. 测试进度管理器导入
|
|
print("\n2. 测试进度管理器导入...")
|
|
try:
|
|
from utils.training_progress import progress_manager
|
|
print("OK 进度管理器导入成功")
|
|
print(f"进度管理器类型: {type(progress_manager)}")
|
|
except Exception as e:
|
|
print(f"ERROR 进度管理器导入失败: {e}")
|
|
|
|
# 3. 测试训练器导入
|
|
print("\n3. 测试训练器导入...")
|
|
try:
|
|
from trainers.mlstm_trainer import train_product_model_with_mlstm
|
|
print("OK mLSTM训练器导入成功")
|
|
|
|
# 检查函数参数
|
|
import inspect
|
|
sig = inspect.signature(train_product_model_with_mlstm)
|
|
params = list(sig.parameters.keys())
|
|
print(f"函数参数: {params}")
|
|
|
|
has_socketio = 'socketio' in params
|
|
has_task_id = 'task_id' in params
|
|
print(f"有socketio参数: {has_socketio}")
|
|
print(f"有task_id参数: {has_task_id}")
|
|
|
|
except Exception as e:
|
|
print(f"ERROR mLSTM训练器导入失败: {e}")
|
|
import traceback
|
|
traceback.print_exc()
|
|
|
|
# 4. 测试数据文件
|
|
print("\n4. 测试数据文件...")
|
|
if os.path.exists('pharmacy_sales_multi_store.csv'):
|
|
print("OK 数据文件存在")
|
|
try:
|
|
df = pd.read_csv('pharmacy_sales_multi_store.csv', nrows=5) # 只读前5行
|
|
print(f"OK 数据文件可读,列: {list(df.columns)}")
|
|
except Exception as e:
|
|
print(f"ERROR 数据文件读取失败: {e}")
|
|
else:
|
|
print("ERROR 数据文件不存在")
|
|
|
|
print("\n=== 简单调试完成 ===") |