Skip to content

Commit ced8462

Browse files
authored
fix: ksampler error when the tensor is not contiguous #535 (#673)
* Update utils.py-fix [Bug] ksampler error #535 * Update utils.py * Update linear.py-fix [Bug] ksampler error #535 New issue
1 parent 27c6193 commit ced8462

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

nunchaku/models/linear.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,12 @@ def forward(self, x: torch.Tensor, output: torch.Tensor | None = None) -> torch.
179179
B: batch size, S: sequence length
180180
"""
181181
batch_size, seq_len, channels = x.shape
182-
x = x.view(batch_size * seq_len, channels)
182+
x = x.reshape(batch_size * seq_len, channels)
183183
if output is None:
184184
output = torch.empty(batch_size * seq_len, self.out_features, dtype=x.dtype, device=x.device)
185185
quantized_x, ascales, lora_act_out = self.quantize(x)
186186
output = self.forward_quant(quantized_x, ascales, lora_act_out, output)
187-
output = output.view(batch_size, seq_len, -1)
187+
output = output.reshape(batch_size, seq_len, -1)
188188
return output
189189

190190
def quantize(self, x: torch.Tensor, pad_size: int = 256) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor]:

0 commit comments

Comments
 (0)