Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
803 changes: 803 additions & 0 deletions IEclaude/README.md

Large diffs are not rendered by default.

69 changes: 69 additions & 0 deletions IEclaude/check_gpu.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/usr/bin/env python3
"""
GPU检测脚本

检查系统中可用的GPU设备
"""

import torch

print("=" * 80)
print("GPU 设备检测")
print("=" * 80)

# 检查CUDA是否可用
if torch.cuda.is_available():
print(f"\n✓ CUDA可用")
print(f" CUDA版本: {torch.version.cuda}")

# 获取GPU数量
num_gpus = torch.cuda.device_count()
print(f" 可用GPU数量: {num_gpus}")

# 列出所有GPU
print(f"\nGPU详细信息:")
for i in range(num_gpus):
print(f"\n GPU {i}:")
print(f" 名称: {torch.cuda.get_device_name(i)}")

# 获取显存信息
props = torch.cuda.get_device_properties(i)
total_memory = props.total_memory / 1024**3 # 转换为GB
print(f" 显存: {total_memory:.2f} GB")

# 当前显存使用情况
if i < num_gpus:
torch.cuda.set_device(i)
allocated = torch.cuda.memory_allocated(i) / 1024**3
reserved = torch.cuda.memory_reserved(i) / 1024**3
print(f" 已分配: {allocated:.2f} GB")
print(f" 已保留: {reserved:.2f} GB")

# 使用建议
print(f"\n" + "=" * 80)
print("使用建议:")
print("=" * 80)

for i in range(num_gpus):
gpu_name = torch.cuda.get_device_name(i)
props = torch.cuda.get_device_properties(i)
total_memory = props.total_memory / 1024**3

print(f"\nGPU {i} ({gpu_name}):")
print(f" 训练命令: python train.py --config configs/config_20.json --gpu {i}")
print(f" 或使用脚本: ./run_all.sh --gpu {i}")

# 根据显存给出batch_size建议
if total_memory < 12:
print(f" 建议batch_size: 4 (显存较小)")
elif total_memory < 24:
print(f" 建议batch_size: 8 (默认)")
else:
print(f" 建议batch_size: 16 (显存充足)")

else:
print(f"\n✗ CUDA不可用")
print(f" 将使用CPU进行训练(速度会很慢)")
print(f" 训练命令: python train.py --config configs/config_20.json")

print("\n" + "=" * 80)
61 changes: 61 additions & 0 deletions IEclaude/configs/config_20.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"comment": "IEclaude配置文件 - 20%缺失率",

"seed": 42,

"data": {
"data_path": "/home/zhu/sssdtcn/LD2011_2014.txt",
"seq_len": 168,
"stride": 84,
"train_ratio": 0.7,
"normalize": "standard"
},

"model": {
"res_channels": 256,
"skip_channels": 256,
"num_res_layers": 36,
"dilation_cycle": 10,

"tcn_channels": [256, 256, 256],
"tcn_kernel_size": 3,
"tcn_dilation_rates": [1, 2, 4, 8],
"tcn_dropout": 0.0,

"s4_d_state": 64,
"s4_n_layers": 4,
"s4_dropout": 0.0,
"s4_bidirectional": true
},

"diffusion": {
"T": 200,
"beta_0": 0.0001,
"beta_T": 0.02,
"schedule": "linear",

"embed_dim_in": 128,
"embed_dim_mid": 512,
"embed_dim_out": 512
},

"train": {
"output_dir": "./results/traffic_20",
"missing_rate": 0.2,
"missing_pattern": "random",

"batch_size": 8,
"epochs": 100,
"learning_rate": 0.0002,
"weight_decay": 0.0,

"scheduler": "cosine",
"min_lr": 1e-6,

"save_interval": 10,
"num_workers": 0,

"only_generate_missing": true,
"clean_before_train": true
}
}
17 changes: 17 additions & 0 deletions IEclaude/data/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""
IEclaude Data Module

包含数据加载和预处理工具
"""

from .traffic_dataloader import (
TrafficDataset,
load_traffic_data,
create_dataloader
)

__all__ = [
'TrafficDataset',
'load_traffic_data',
'create_dataloader'
]
Loading