(self,
in_features,
out_features,
bias=True,
dtype=None,
tp_group=None,
tp_size=1,
gather_output=True,
quant_mode=QuantMode(0))
| 571 | class Fp8RowwiseLinear(Linear): |
| 572 | |
| 573 | def __init__(self, |
| 574 | in_features, |
| 575 | out_features, |
| 576 | bias=True, |
| 577 | dtype=None, |
| 578 | tp_group=None, |
| 579 | tp_size=1, |
| 580 | gather_output=True, |
| 581 | quant_mode=QuantMode(0)): |
| 582 | super().__init__(in_features, |
| 583 | out_features, |
| 584 | bias=bias, |
| 585 | dtype=dtype, |
| 586 | tp_group=tp_group, |
| 587 | tp_size=tp_size, |
| 588 | gather_output=gather_output) |
| 589 | |
| 590 | if not quant_mode.has_fp8_rowwise(): |
| 591 | raise ValueError( |
| 592 | "Fp8 Rowwise Linear has to have act+weight quantization mode set" |
| 593 | ) |
| 594 | |
| 595 | weights_dtype = dtype |
| 596 | if quant_mode.has_fp8_rowwise(): |
| 597 | weights_dtype = "fp8" |
| 598 | |
| 599 | self.weight = Parameter(shape=(self.out_features, self.in_features), |
| 600 | dtype=weights_dtype) |
| 601 | |
| 602 | if quant_mode.has_fp8_rowwise(): |
| 603 | self.per_channel_scale = Parameter(shape=(self.out_features, ), |
| 604 | dtype="float32") |
| 605 | |
| 606 | self.quant_mode = quant_mode |
| 607 | self.tllm_to_externel_key_dict = {"weight": ["weight", "weight_scale"]} |
| 608 | |
| 609 | def forward(self, x, lora_runtime_params=None): |
| 610 | assert lora_runtime_params is None, "lora is not supported on SmoothQuantLinear now" |
nothing calls this directly
no test coverage detected