Skip to content

Commit

Permalink
pylint;
Browse files Browse the repository at this point in the history
Signed-off-by: Alexandros Koumparoulis <[email protected]>
  • Loading branch information
akoumpa committed Feb 11, 2025
1 parent ecdad85 commit aa17fc5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions nemo/lightning/io/hf.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,16 @@ def is_rank_0():


class HFAdapterKeyRenamer:
"""Dummy class for key renaming"""
@staticmethod
def nemo_to_hf(x):
""" Converts lora adapter FQNs to HF"""
return x.replace("model.model.", "base_model.model.model.", 1) \
.replace("lora_a.weight", "lora_A.weight", 1) \
.replace("lora_b.weight", "lora_B.weight", 1)
@staticmethod
def hf_to_nemo(x):
""" Converts lora adapter FQNs to NeMo"""
return x.replace("lora_B.weight", "lora_b.weight", 1) \
.replace("lora_A.weight", "lora_a.weight", 1) \
.replace("base_model.model.model.", "model.model.", 1)
Expand Down

0 comments on commit aa17fc5

Please sign in to comment.