MCPcopy Create free account
hub / github.com/Alpha-VLLM/LLaMA2-Accessory / forward_RowParallelLinear

Function forward_RowParallelLinear

accessory/util/quant.py:32–46  ·  view source on GitHub ↗
(self, input_: torch.Tensor)

Source from the content-addressed store, hash-verified

30 return output
31
32def forward_RowParallelLinear(self, input_: torch.Tensor) -> torch.Tensor: # type:ignore
33 # Set up backprop all-reduce.
34 if self.input_is_parallel:
35 input_parallel = input_
36 else:
37 input_parallel = scatter_to_model_parallel_region(input_)
38 # Matrix multiply.
39 output_parallel = self.quanted_layer(input_parallel)
40 # All-reduce across all the partitions.
41 output_ = reduce_from_model_parallel_region(output_parallel)
42 if self.bias is not None:
43 output = output_ + self.bias
44 else:
45 output = output_
46 return output
47
48def forward_LoraColumnParallelLinear(self, input_: torch.Tensor) -> torch.Tensor: # type: ignore
49 # Set up backprop all-reduce.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected