Last active
April 28, 2022 09:35
-
-
Save blythed/747dc3896f8b6cd16686e524c3f7ec74 to your computer and use it in GitHub Desktop.
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
import padl | |
import torch | |
from padl import params | |
from my_codebase.pipelines import build_string_processor, build_preprocessor, build_model | |
from my_codebase.models import build_classifier | |
from my_codebase.transforms import Dictionary, build_dictionary | |
nn = padl.transform(torch.nn) | |
string_processor = build_string_processor() | |
words = padl.value(build_dictionary(string_processor, 'corpus.txt')) | |
dictionary = Dictionary(words) | |
preprocess = build_preprocessor(dictionary, string_processor) | |
rnn = torch.nn.GRU( | |
num_layers=1, | |
**params( | |
'rnn', | |
input_size=len(dictionary), | |
hidden_size=512, | |
), | |
) | |
layer = build_classifier( | |
rnn, | |
len(dictionary), | |
) | |
m = build_model(layer, preprocess) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment