(self, input_: torch.Tensor)
| 46 | return output |
| 47 | |
| 48 | def forward_LoraColumnParallelLinear(self, input_: torch.Tensor) -> torch.Tensor: # type: ignore |
| 49 | # Set up backprop all-reduce. |
| 50 | input_parallel = copy_to_model_parallel_region(input_) |
| 51 | # Matrix multiply. |
| 52 | output_parallel = self.quanted_layer(input_parallel) |
| 53 | if self.bias is not None: |
| 54 | output_parallel = output_parallel + self.bias |
| 55 | if self.lora_a is not None: |
| 56 | modification = self.lora_b(self.lora_a(input_)) |
| 57 | else: |
| 58 | modification = None |
| 59 | |
| 60 | if self.gather_output: |
| 61 | # All-gather across the partitions. |
| 62 | output = gather_from_model_parallel_region(output_parallel) |
| 63 | else: |
| 64 | output = output_parallel |
| 65 | |
| 66 | if modification is not None: |
| 67 | output = output + modification |
| 68 | return output |
| 69 | |
| 70 | def forward_LoraRowParallelLinear(self, input_: torch.Tensor) -> torch.Tensor: # type:ignore |
| 71 | # Set up backprop all-reduce. |
nothing calls this directly
no outgoing calls
no test coverage detected