File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
vllm/model_executor/models Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -78,6 +78,7 @@ def __init__(
78
78
) -> None :
79
79
super ().__init__ ()
80
80
self .split_gate_up = split_gate_up
81
+ self .hidden_size = hidden_size
81
82
if self .split_gate_up :
82
83
self .gate_proj = ColumnParallelLinear (
83
84
input_size = hidden_size ,
@@ -116,13 +117,19 @@ def __init__(
116
117
self .act_fn = SiluAndMul ()
117
118
118
119
def forward (self , x , skip_seq_split = False ):
120
+ batch_size = x .size (0 )
121
+ seq_len = x .size (1 )
122
+ if (seq_len * batch_size )% 512 == 0 :
123
+ x = x .view (- 1 ,512 ,self .hidden_size )
119
124
if self .split_gate_up :
120
125
x = nn .functional .silu (self .gate_proj (x )[0 ]) * self .up_proj (x )[0 ]
121
126
else :
122
127
x , _ = self .gate_up_proj (x )
123
128
x = self .act_fn (x )
124
129
self .down_proj .skip_seq_split = skip_seq_split
125
130
x , _ = self .down_proj (x )
131
+ if (seq_len * batch_size )% 512 == 0 :
132
+ x = x .view (batch_size ,seq_len ,self .hidden_size )
126
133
return x
127
134
128
135
You can’t perform that action at this time.
0 commit comments