Skip to content

Commit

Permalink
Fix werner-duvaud#89 (residual block)
Browse files Browse the repository at this point in the history
  • Loading branch information
werner-duvaud committed Nov 20, 2020
1 parent f0f73ec commit 267285d
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion games/atari.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def __init__(self):
self.batch_size = 1024 # Number of parts of games to train on at each training step
self.checkpoint_interval = int(1e3) # Number of training steps before using the model for self-playing
self.value_loss_weight = 0.25 # Scale the value loss to avoid overfitting of the value function, paper recommends 0.25 (See paper appendix Reanalyze)
self.train_on_gpu = True if torch.cuda.is_available() else False # Train on GPU if available
self.train_on_gpu = torch.cuda.is_available() # Train on GPU if available

self.optimizer = "SGD" # "Adam" or "SGD". Paper uses SGD
self.weight_decay = 1e-4 # L2 weights regularization
Expand Down
2 changes: 1 addition & 1 deletion games/breakout.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def __init__(self):
self.batch_size = 16 # Number of parts of games to train on at each training step
self.checkpoint_interval = 500 # Number of training steps before using the model for self-playing
self.value_loss_weight = 0.25 # Scale the value loss to avoid overfitting of the value function, paper recommends 0.25 (See paper appendix Reanalyze)
self.train_on_gpu = True if torch.cuda.is_available() else False # Train on GPU if available
self.train_on_gpu = torch.cuda.is_available() # Train on GPU if available

self.optimizer = "Adam" # "Adam" or "SGD". Paper uses SGD
self.weight_decay = 1e-4 # L2 weights regularization
Expand Down
2 changes: 1 addition & 1 deletion games/cartpole.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def __init__(self):
self.batch_size = 128 # Number of parts of games to train on at each training step
self.checkpoint_interval = 10 # Number of training steps before using the model for self-playing
self.value_loss_weight = 1 # Scale the value loss to avoid overfitting of the value function, paper recommends 0.25 (See paper appendix Reanalyze)
self.train_on_gpu = True if torch.cuda.is_available() else False # Train on GPU if available
self.train_on_gpu = torch.cuda.is_available() # Train on GPU if available

self.optimizer = "Adam" # "Adam" or "SGD". Paper uses SGD
self.weight_decay = 1e-4 # L2 weights regularization
Expand Down
2 changes: 1 addition & 1 deletion games/connect4.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def __init__(self):
self.batch_size = 64 # Number of parts of games to train on at each training step
self.checkpoint_interval = 10 # Number of training steps before using the model for self-playing
self.value_loss_weight = 0.25 # Scale the value loss to avoid overfitting of the value function, paper recommends 0.25 (See paper appendix Reanalyze)
self.train_on_gpu = True if torch.cuda.is_available() else False # Train on GPU if available
self.train_on_gpu = torch.cuda.is_available() # Train on GPU if available

self.optimizer = "Adam" # "Adam" or "SGD". Paper uses SGD
self.weight_decay = 1e-4 # L2 weights regularization
Expand Down
2 changes: 1 addition & 1 deletion games/gomoku.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def __init__(self):
self.batch_size = 512 # Number of parts of games to train on at each training step
self.checkpoint_interval = 50 # Number of training steps before using the model for self-playing
self.value_loss_weight = 1 # Scale the value loss to avoid overfitting of the value function, paper recommends 0.25 (See paper appendix Reanalyze)
self.train_on_gpu = True if torch.cuda.is_available() else False # Train on GPU if available
self.train_on_gpu = torch.cuda.is_available() # Train on GPU if available

self.optimizer = "Adam" # "Adam" or "SGD". Paper uses SGD
self.weight_decay = 1e-4 # L2 weights regularization
Expand Down
2 changes: 1 addition & 1 deletion games/gridworld.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def __init__(self):
self.batch_size = 128 # Number of parts of games to train on at each training step
self.checkpoint_interval = 10 # Number of training steps before using the model for self-playing
self.value_loss_weight = 1 # Scale the value loss to avoid overfitting of the value function, paper recommends 0.25 (See paper appendix Reanalyze)
self.train_on_gpu = True if torch.cuda.is_available() else False # Train on GPU if available
self.train_on_gpu = torch.cuda.is_available() # Train on GPU if available

self.optimizer = "Adam" # "Adam" or "SGD". Paper uses SGD
self.weight_decay = 1e-4 # L2 weights regularization
Expand Down
2 changes: 1 addition & 1 deletion games/lunarlander.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def __init__(self):
self.batch_size = 64 # Number of parts of games to train on at each training step
self.checkpoint_interval = 10 # Number of training steps before using the model for self-playing
self.value_loss_weight = 1 # Scale the value loss to avoid overfitting of the value function, paper recommends 0.25 (See paper appendix Reanalyze)
self.train_on_gpu = True if torch.cuda.is_available() else False # Train on GPU if available
self.train_on_gpu = torch.cuda.is_available() # Train on GPU if available

self.optimizer = "Adam" # "Adam" or "SGD". Paper uses SGD
self.weight_decay = 1e-4 # L2 weights regularization
Expand Down
2 changes: 1 addition & 1 deletion games/simple_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def __init__(self):
self.batch_size = 32 # Number of parts of games to train on at each training step
self.checkpoint_interval = 10 # Number of training steps before using the model for self-playing
self.value_loss_weight = 1 # Scale the value loss to avoid overfitting of the value function, paper recommends 0.25 (See paper appendix Reanalyze)
self.train_on_gpu = True if torch.cuda.is_available() else False # Train on GPU if available
self.train_on_gpu = torch.cuda.is_available() # Train on GPU if available

self.optimizer = "Adam" # "Adam" or "SGD". Paper uses SGD
self.weight_decay = 1e-4 # L2 weights regularization
Expand Down
2 changes: 1 addition & 1 deletion games/tictactoe.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def __init__(self):
self.batch_size = 64 # Number of parts of games to train on at each training step
self.checkpoint_interval = 10 # Number of training steps before using the model for self-playing
self.value_loss_weight = 0.25 # Scale the value loss to avoid overfitting of the value function, paper recommends 0.25 (See paper appendix Reanalyze)
self.train_on_gpu = True if torch.cuda.is_available() else False # Train on GPU if available
self.train_on_gpu = torch.cuda.is_available() # Train on GPU if available

self.optimizer = "Adam" # "Adam" or "SGD". Paper uses SGD
self.weight_decay = 1e-4 # L2 weights regularization
Expand Down
2 changes: 1 addition & 1 deletion games/twentyone.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def __init__(self):
self.batch_size = 64 # Number of parts of games to train on at each training step
self.checkpoint_interval = 10 # Number of training steps before using the model for self-playing
self.value_loss_weight = 0.25 # Scale the value loss to avoid overfitting of the value function, paper recommends 0.25 (See paper appendix Reanalyze)
self.train_on_gpu = True if torch.cuda.is_available() else False # Train on GPU if available
self.train_on_gpu = torch.cuda.is_available() # Train on GPU if available

self.optimizer = "SGD" # "Adam" or "SGD". Paper uses SGD
self.weight_decay = 1e-4 # L2 weights regularization
Expand Down
16 changes: 8 additions & 8 deletions models.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,14 +219,14 @@ def __init__(self, num_channels, stride=1):
self.bn2 = torch.nn.BatchNorm2d(num_channels)

def forward(self, x):
x = self.conv1(x)
x = self.bn1(x)
x = torch.nn.functional.relu(x)
x = self.conv2(x)
x = self.bn2(x)
x += x
x = torch.nn.functional.relu(x)
return x
out = self.conv1(x)
out = self.bn1(out)
out = torch.nn.functional.relu(out)
out = self.conv2(out)
out = self.bn2(out)
out += x
out = torch.nn.functional.relu(out)
return out


# Downsample observations before representation network (See paper appendix Network Architecture)
Expand Down

0 comments on commit 267285d

Please sign in to comment.