jkim96 commited on
Commit
b2eb3f9
·
verified ·
1 Parent(s): d032bc1

Add DASH-Q remote-code inference (Triton decode kernel)

Browse files
Files changed (1) hide show
  1. dashq_kernel.py +0 -23
dashq_kernel.py CHANGED
@@ -165,29 +165,6 @@ class TritonQuantLinear(nn.Module):
165
  in_features // self.group_size,
166
  )
167
 
168
- @classmethod
169
- def from_packed(cls, module: nn.Module, **kwargs) -> "TritonQuantLinear":
170
- """Build from a dashq.quantization.PackedQuantizedLinear instance."""
171
- from dashq.quantization import _unpack_int_values
172
-
173
- K = int(getattr(module, "quant_in_features", module.in_features))
174
- N = int(module.out_features)
175
- W_int = _unpack_int_values(module.W_q_packed, module.nbits, module.numel).view(N, K)
176
- num_groups = K // int(module.group_size)
177
- scale = module.scale.view(N, num_groups)
178
- zero = module.zero.view(N, num_groups)
179
- bias = module.bias if getattr(module, "bias", None) is not None else None
180
- return cls(
181
- W_int,
182
- scale,
183
- zero,
184
- int(module.nbits),
185
- int(module.group_size),
186
- bias=bias,
187
- out_dtype=getattr(module, "linear_dtype", torch.float16),
188
- **kwargs,
189
- )
190
-
191
  def dequantize_weight(self, dtype: torch.dtype) -> torch.Tensor:
192
  """Returns W^T as (in_features, out_features), matching the K-major layout."""
193
  if self.nbits == 3:
 
165
  in_features // self.group_size,
166
  )
167
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
168
  def dequantize_weight(self, dtype: torch.dtype) -> torch.Tensor:
169
  """Returns W^T as (in_features, out_features), matching the K-major layout."""
170
  if self.nbits == 3: