(self, input_: torch.Tensor)
| 68 | return output |
| 69 | |
| 70 | def forward_LoraRowParallelLinear(self, input_: torch.Tensor) -> torch.Tensor: # type:ignore |
| 71 | # Set up backprop all-reduce. |
| 72 | if self.input_is_parallel: |
| 73 | input_parallel = input_ |
| 74 | else: |
| 75 | input_parallel = scatter_to_model_parallel_region(input_) |
| 76 | # Matrix multiply. |
| 77 | output_parallel = self.quanted_layer(input_parallel) |
| 78 | # All-reduce across all the partitions. |
| 79 | output_ = reduce_from_model_parallel_region(output_parallel) |
| 80 | if self.lora_a is not None: |
| 81 | modification = self.lora_b(self.lora_a(input_parallel)) |
| 82 | output_ = output_ + modification |
| 83 | if self.bias is not None: |
| 84 | output = output_ + self.bias |
| 85 | else: |
| 86 | output = output_ |
| 87 | return output |
| 88 | |
| 89 | def forward_Linear(self, input: torch.Tensor) -> torch.Tensor: |
| 90 | output = self.quanted_layer(input) |
nothing calls this directly
no outgoing calls
no test coverage detected