Skip to content

Commit

Permalink
Add fn to get fp32 lora layers (#3160)
Browse files Browse the repository at this point in the history
Signed-off-by: Harshita Mangal <quic_mangal@quicinc.com>
  • Loading branch information
quic-mangal committed Jul 11, 2024
1 parent 52da505 commit df67bc7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions TrainingExtensions/torch/src/python/aimet_torch/peft.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,18 @@ def get_quantized_lora_layer(self, sim: QuantizationSimModel):
if isinstance(module, BaseQuantizationMixin) and module_name in self.pt_to_lora_name:
yield module_name, module

def get_fp_lora_layer(self, model):
"""
This Function can be used to get lora layers for a model
:param model: FP32 model
"""
for module_name, module in model.named_modules():
if self.prepared_name_to_pt_name and module_name in self.prepared_name_to_pt_name:
module_name = self.prepared_name_to_pt_name[module_name]
if module_name in self.pt_to_lora_name:
yield module_name, module

@staticmethod
def _set_bitwidth_for_module(module: BaseQuantizationMixin, output_bw: int, param_bw: int):
"""
Expand Down

0 comments on commit df67bc7

Please sign in to comment.