-
Notifications
You must be signed in to change notification settings - Fork 33
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
Encounter RuntimeError while running with Apex #60
Comments
Thanks! I'll have a look |
I found a manual solution that works. Install PyTorch Metric Learning from source and change: torch.max(neg_pairs, dim=1, keepdim=True)[0]) to torch.max(neg_pairs, dim=1, keepdim=True)[0].half()) in |
I think this happens because I create infinity values using python's |
Ah, I think you are right. There's a discussion on this HF Transformers PR where they end up writing an masked_bias = self.masked_bias.to(w.dtype)
assert masked_bias.item() != -float("inf"), "Make sure `self.masked_bias` is not `-inf` in fp16 mode"
w = torch.where(mask, w, masked_bias) What about replacing |
At least for NTXentLoss, setting it to a large negative value (instead of |
Awesome, thanks for weighing in! |
v0.9.90.dev0 supports half precision
|
@KevinMusgrave Awesome! Thanks a lot. |
Running apex with
allennlp train configs/contrastive.jsonnet -s tmp --include-package t2t -o "{"trainer": {"opt_level": 'O1'}}"
returns exceptions as following:The text was updated successfully, but these errors were encountered: