Skip to content
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

Merged
merged 33 commits into from
Aug 8, 2017
Merged

Features/evaluation step #22

merged 33 commits into from
Aug 8, 2017

Conversation

ottonemo
Copy link
Member

See also #12 (comment)

…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()
Copy link
Contributor

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
Copy link
Contributor

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])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leave this restriction in?

@ottonemo
Copy link
Member Author

ottonemo commented Aug 8, 2017

@benjamin-work review again pls

@benjamin-work benjamin-work merged commit 5f0f29a into master Aug 8, 2017
@ottonemo ottonemo deleted the features/evaluation_step branch October 2, 2017 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants