-
Notifications
You must be signed in to change notification settings - Fork 5
How to use DeepDebugger
xianglin edited this page Aug 4, 2023
·
4 revisions
import sys
DeepDebugger_path = "/home/xiangling/git_space/DeepDebugger"
sys.path.append(DeepDebugger_path)from writer.summary_writer import SummaryWriter
log_dir = "path/to/dir" # User define
writer = SummaryWriter(log_dir)writer.add_training_data(record_train_dataloader) # use test_transform
writer.add_testing_data(valid_dataloader)idxs = list(range(len(train_dataset))
# Noted the first epoch is less than 1
writer.add_checkpoint_data(model.state_dict(), idxs, epoch+1, epoch)Record classes, train_num, test_num, feature_dimension
# >>>>>>>>>> Record Config
config_dict = {
"SETTING": "normal",
"CLASSES": CLASSES ,
"GPU":"1",
"DATASET": "speech_commands",
"EPOCH_START": 1,
"EPOCH_END": 5,
"EPOCH_PERIOD": 1,
"TRAINING": {
"NET": "vgg19_bn", # name it after your net
"num_class": 10,
"train_num": 56196,
"test_num": 7477,
},
"VISUALIZATION":{
"PREPROCESS":1,
"BOUNDARY":{
"B_N_EPOCHS": 0,
"L_BOUND":0.5,
},
"INIT_NUM": 300,
"ALPHA":1,
"BETA":1,
"MAX_HAUSDORFF":0.33,
"LAMBDA": 1,
"S_LAMBDA": 1,
"ENCODER_DIMS":[512,256,256,256,2],
"DECODER_DIMS":[2,256,256,256,512],
"N_NEIGHBORS":15,
"MAX_EPOCH": 20,
"S_N_EPOCHS": 5,
"T_N_EPOCHS": 20,
"PATIENT": 3,
"RESOLUTION":300,
"VIS_MODEL_NAME": "TimeVis",
"EVALUATION_NAME": "test_evaluation_TimeVis"
}
}
# <<<<<<<<<< Record Configimport os,json
# save config
config = dict()
config["TimeVis"] = config_dict
with open(os.path.join(log_dir, "config.json"), "w") as f:
json.dump(config, f)The model should embed a feature func and a prediction func.
from strategy import TimeVis
dd = TimeVis(log_dir, config_dict)
dd.visualize_embedding()