File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed
backends/candle/src/layers Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ use serde::Deserialize;
7
7
pub enum HiddenAct {
8
8
Gelu ,
9
9
Relu ,
10
- # [ serde ( alias = "silu" ) ]
10
+ Silu ,
11
11
Swiglu ,
12
12
}
13
13
@@ -16,9 +16,8 @@ impl HiddenAct {
16
16
match self {
17
17
Self :: Gelu => x. gelu ( ) ,
18
18
Self :: Relu => x. relu ( ) ,
19
- // NOTE: use SiLU instead candle's SwiGLU, as SwiGLU is SiLU + down projection
20
- // to half size since we split on intermediate dimension
21
- Self :: Swiglu => x. silu ( ) ,
19
+ Self :: Silu => x. silu ( ) ,
20
+ Self :: Swiglu => candle_nn:: ops:: swiglu ( & x) ,
22
21
}
23
22
}
24
23
}
@@ -82,9 +81,8 @@ impl Linear {
82
81
match act {
83
82
HiddenAct :: Gelu => x. gelu ( ) ,
84
83
HiddenAct :: Relu => x. relu ( ) ,
85
- // NOTE: use SiLU instead candle's SwiGLU, as SwiGLU is SiLU + down projection
86
- // to half size since we split on intermediate dimension
87
- HiddenAct :: Swiglu => x. silu ( ) ,
84
+ HiddenAct :: Silu => x. silu ( ) ,
85
+ HiddenAct :: Swiglu => candle_nn:: ops:: swiglu ( & x) ,
88
86
}
89
87
} else {
90
88
Ok ( x)
You can’t perform that action at this time.
0 commit comments