'val':deepcopy(Mode), 'Inputs':inputs, 'Targets':targets, } C['val']['loss_color'] = 'r' C['train']['all_indicies'], C['val']['all_indicies'] = \ utils.get_train_and_val_indicies(len(C['Targets']),100) cg("C['val']['all_indicies'] =",len(C['val']['all_indicies'])) cg("C['train']['all_indicies'] =",len(C['train']['all_indicies'])) """ chain_net = Chain_net() if A['load_net']: #best_path = find_best_net(A['net_path']) best_path = most_recent_file_in_folder(A['net_path']) cg("Loading net from",best_path) chain_net.load_state_dict(torch.load(best_path)) #chain_net = torch.nn.DataParallel(chain_net) chain_net.to(device) cg('chain_net.to(device)') criterion = nn.MSELoss() optimizer = optim.Adam(chain_net.parameters(), A['learning_rate']) #, lr=0.001) os_system('mkdir -p',A['net_path'])
'val': deepcopy(Mode), 'Inputs': inputs, 'Targets': targets, } C['val']['loss_color'] = 'r' C['train']['all_indicies'], C['val']['all_indicies'] = \ utils.get_train_and_val_indicies(len(C['Targets']),100) cg("C['val']['all_indicies'] =", len(C['val']['all_indicies'])) cg("C['train']['all_indicies'] =", len(C['train']['all_indicies'])) modes = ['train', 'val'] chain_net = Chain_net() if A['load_net']: #best_path = find_best_net(A['net_path']) best_path = most_recent_file_in_folder(A['net_path']) cg("Loading net from", best_path) chain_net.load_state_dict(torch.load(best_path)) #chain_net = torch.nn.DataParallel(chain_net) chain_net.to(device) criterion = nn.MSELoss() optimizer = optim.Adam(chain_net.parameters(), A['learning_rate']) #, lr=0.001) os_system('mkdir -p', A['net_path'])
A[m] = deepcopy(Mode) A['data_file_paths'] = sggo(A['data_path'], '*.h5py') A['train']['opened_data_files'] = [] A['val']['opened_data_files'] = [] for f in A['data_file_paths']: for mode in ['val', 'train']: if mode + '_' in fname(f): A[mode]['opened_data_files'].append(h5r(f)) A['val']['loss_color'] = 'r' A['train']['loss_color'] = 'b' A['val']['current_index'] = -1 A['train']['current_index'] = -1 chain_net_original = Chain_net() backend = 'fbgemm' #backend = 'FakeQuantize' chain_net_original.train() chain_net_original.qconfig = torch.quantization.get_default_qat_qconfig( backend) chain_net_original.aa.qconfig = torch.quantization.get_default_qat_qconfig( backend) chain_net_original.aa.d.qconfig = torch.quantization.get_default_qat_qconfig( backend) chain_net_original.aa.e.qconfig = torch.quantization.get_default_qat_qconfig( backend)