-
Notifications
You must be signed in to change notification settings - Fork 382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Features/evaluation step #22
Conversation
…ted to a 3d torch tensor; did this test ever pass?
Related to pull/12#discussion_r129337961
Generator does not use validation data
This corresponds with the original code
Sampling is only necessary in text generation
…is collated to a 3d torch tensor; did this test ever pass?" This reverts commit fdcc5bf. This is not necessary anymore (as per discussion). We expect that `forward` receives a list of torch tensors in case the input is a list of sequences (e.g. numpy arrays).
This reverts commit 2b7a005. Belongs into own branch
This reverts commit b54b1ef. Belongs into own branch
As `to_var` is already needed in every `*_step()` function we don't call it in `infer()` as well. This also makes it easier to overwrite individual step functions without touching `infer`.
This makes it possible to have CUDA models as the call from to_tensor on dummy values does not fail.
Rationale being that one sequence can be evaluated in one step and processes that use statefulness should resort to custom methods.
Also implement example sentence printer callback to training process. Simplify generation process accordingly.
def on_train_begin(self, net, *args, **kwargs): | ||
self.hidden = self.module_.init_hidden(self.batch_size) | ||
def on_train_begin(self, *args, **kwargs): | ||
super().on_train_begin(*args, **kwargs) | ||
if self.use_cuda: | ||
self.module_.cuda() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need the cuda call? We now have it in initialize_module
.
self.hidden = self.module_.init_hidden(self.batch_size) | ||
|
||
def sample(self, input, temperature=1., hidden=None): | ||
hidden = self.module_.init_hidden(1) if hidden is not None else hidden |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the logic correct here: Don't use provided hidden if it is not None?
params = [ | ||
{ | ||
'lr': [10,20,30], | ||
}, | ||
] | ||
|
||
pl = GridSearchCV(learner, params) | ||
pl.fit(corpus.train[:1000], corpus.train[:1000]) | ||
pl.fit(corpus.train[:1000]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leave this restriction in?
@benjamin-work review again pls |
See also #12 (comment)