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

Faster forward pass + tests on GPU #123

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Academich
Copy link

Hello! Thank you for your CRF implementation! Here is a couple of improvements I would like to propose:

  1. Removed the python cycle from the _compute_score method. The same scores can be calculated much faster using pytorch functions without python loops. The difference in speed is especially large on a GPU.
  2. Changed the type of the mask from ByteTensor to BoolTensor. If the mask is ByteTensor, pytorch throws warnings that it's deprecated and asks to change the mask type to BoolTensor.
  3. Added tests for the forward pass on a GPU. The code of the TestForwardOnCuda class is basically identical to TestForward, but the model and inputs are moved to the GPU first.

@coveralls
Copy link

Coverage Status

coverage: 100.0%. remained the same
when pulling 966af5a on Academich:master
into 623e340 on kmkurn:master.

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.

2 participants