This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def initialize_model(hidden_dim, hidden_layers, lr, device): | |
# As in line 11, pass your model to nn.DataParallel class | |
# Pytorch would now parallelize your model trainig if multiple GPU's are found during initialization. | |
input_dim = alph_len * 3 | |
hidden_dim = hidden_dim | |
layer_dim = hidden_layers | |
output_dim = 2 | |
model = LSTMModel(input_dim, hidden_dim, layer_dim, output_dim, device) |