Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Fix training Conditional Random Fields on GPU (#5313) #5315

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

- Fixed missing device mapping in the `allennlp.modules.conditional_random_field.py` file.
- Fixed Broken link in `allennlp.fairness.fairness_metrics.Separation` docs
- Ensured all `allennlp` submodules are imported with `allennlp.common.plugins.import_plugins()`.
- Fixed `IndexOutOfBoundsException` in `MultiOptimizer` when checking if optimizer received any parameters.
Expand Down
2 changes: 1 addition & 1 deletion allennlp/modules/conditional_random_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ def forward(
"""

if mask is None:
mask = torch.ones(*tags.size(), dtype=torch.bool)
mask = torch.ones(*tags.size(), dtype=torch.bool, device=inputs.device)
else:
# The code below fails in weird ways if this isn't a bool tensor, so we make sure.
mask = mask.to(torch.bool)
Expand Down