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

Evaluation does not reset hidden states. #7

Open
lyf-1 opened this issue Nov 28, 2020 · 1 comment
Open

Evaluation does not reset hidden states. #7

lyf-1 opened this issue Nov 28, 2020 · 1 comment

Comments

@lyf-1
Copy link

lyf-1 commented Nov 28, 2020

        with torch.no_grad():
            hidden = self.model.init_hidden()
            for ii, (input, target, mask) in tqdm(enumerate(dataloader), total=len(dataloader.dataset.df) // dataloader.batch_size, miniters = 1000):
            #for input, target, mask in dataloader:
                input = input.to(self.device)
                target = target.to(self.device)
                logit, hidden = self.model(input, hidden)
                logit_sampled = logit[:, target.view(-1)]
                loss = self.loss_func(logit_sampled)
                recall, mrr = lib.evaluate(logit, target, k=self.topk)

Hi, lib.evaluation.Evaluation does not reset hidden staes. Is that right?

@hungpthanh
Copy link
Owner

hungpthanh commented Dec 7, 2020

@lyf-1 Sorry for my late reply,
Yes, you are right, lib.evaluation.Evaluation does not reset hidden staes.
I think that hidden state should be reseted before the input goes through the model.
Thank you for your question!

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

No branches or pull requests

2 participants