Skip to content

Commit

Permalink
allenai#5313 Fix training Conditional Random Fields on GPU
Browse files Browse the repository at this point in the history
  • Loading branch information
alle-pawols committed Jul 16, 2021
1 parent 39c40fe commit 0775b33
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 0775b33

Please sign in to comment.