Skip to content

Commit

Permalink
Fix training Conditional Random Fields on GPU (allenai#5313)
Browse files Browse the repository at this point in the history
  • Loading branch information
alle-pawols committed Jul 16, 2021
1 parent 7d4a672 commit 0869d08
Showing 1 changed file with 1 addition and 1 deletion.
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

0 comments on commit 0869d08

Please sign in to comment.