Unverified Commit d4867951 authored by Lysandre Debut's avatar Lysandre Debut Committed by GitHub
Browse files

JIT not compatible with PyTorch/XLA (#3743)

parent b1e2368b
import logging
import math
import torch
import torch.nn.functional as F
logger = logging.getLogger(__name__)
def swish(x):
return x * torch.sigmoid(x)
......@@ -29,6 +33,14 @@ if torch.__version__ < "1.4.0":
gelu = _gelu_python
else:
gelu = F.gelu
try:
import torch_xla # noqa F401
logger.warning(
"The torch_xla package was detected in the python environment. PyTorch/XLA and JIT is untested,"
" no activation function will be traced with JIT."
)
except ImportError:
gelu_new = torch.jit.script(gelu_new)
ACT2FN = {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment