File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -98,7 +98,10 @@ def get_act_fn(name='relu'):
9898 # custom autograd, then fallback
9999 if name in _ACT_FN_ME :
100100 return _ACT_FN_ME [name ]
101- if not is_no_jit ():
101+ if is_exportable () and name in ('silu' , 'swish' ):
102+ # FIXME PyTorch SiLU doesn't ONNX export, this is a temp hack
103+ return swish
104+ if not (is_no_jit () or is_exportable ()):
102105 if name in _ACT_FN_JIT :
103106 return _ACT_FN_JIT [name ]
104107 return _ACT_FN_DEFAULT [name ]
@@ -114,7 +117,10 @@ def get_act_layer(name='relu'):
114117 if not (is_no_jit () or is_exportable () or is_scriptable ()):
115118 if name in _ACT_LAYER_ME :
116119 return _ACT_LAYER_ME [name ]
117- if not is_no_jit ():
120+ if is_exportable () and name in ('silu' , 'swish' ):
121+ # FIXME PyTorch SiLU doesn't ONNX export, this is a temp hack
122+ return Swish
123+ if not (is_no_jit () or is_exportable ()):
118124 if name in _ACT_LAYER_JIT :
119125 return _ACT_LAYER_JIT [name ]
120126 return _ACT_LAYER_DEFAULT [name ]
You can’t perform that action at this time.
0 commit comments