Skip to content

Commit

Permalink
Customize actfn in fc layers
Browse files Browse the repository at this point in the history
  • Loading branch information
ange1a-j14 committed Oct 13, 2024
1 parent baf1079 commit 347550b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion models.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def __init__(self, input_size, output_size, ch_in=1, activation='LeakyReLU'):
)
self.fc_layers = nn.Sequential(
nn.Linear(640, 16),
nn.ReLU(),
act_fn_by_name[activation],
nn.Linear(16, output_size)
)

Expand Down
8 changes: 4 additions & 4 deletions train.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ def __init__(self, test_mode, h5_file, step, group_size=256):
self.step = step
self.group_size = group_size
with h5py.File(self.h5_file, 'r') as f:
num_groups = (f['Time (s)'].shape[1] - group_size) // step + 1
num_groups = (f['PD (V)'].shape[1] - group_size) // step + 1
if test_mode:
self.length = len(f['Time (s)']) # in test_mode, length of dataset = num shots
self.length = len(f['PD (V)']) # in test_mode, length of dataset = num shots
else:
self.length = len(f['Time (s)']) * num_groups
self.length = len(f['PD (V)']) * num_groups
print(self.h5_file)
self.opened_flag = False
self.test_mode = test_mode
Expand Down Expand Up @@ -210,7 +210,7 @@ def train_model(self, model_name, save_name=None, **kwargs):
return model, result

def scan_hyperparams(self):
lr_list = [1e-3, 1e-4] # [1e-3, 1e-4, 1e-5]
lr_list = [1e-3, 1e-4]# [1e-3, 1e-4, 1e-5] # [1e-3, 1e-4, 1e-5]
act_list = ['LeakyReLU'] #, 'ReLU']
optim_list = ['Adam'] #, 'SGD']
for lr, activation, optim in product(lr_list, act_list, optim_list): #, 1e-2, 3e-2]:
Expand Down

0 comments on commit 347550b

Please sign in to comment.