Skip to content

Commit

Permalink
add lora support
Browse files Browse the repository at this point in the history
  • Loading branch information
Parry-Parry committed Dec 11, 2024
1 parent 24f7d6f commit e417e85
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions rankers/modelling/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,21 @@ def __init__(
def prepare_outputs(self, logits, labels=None):
raise NotImplementedError("prepare_outputs must be implemented by subclasses")

def add_adapter(self, config, adapter_name='adapter', **kwargs):
self.model.add_adapter(config, adapter_name=adapter_name, **kwargs)

def set_adapter(self, adapter_name='adapter'):
self.model.set_adapter(adapter_name)

def disable_adapters(self):
self.model.disable_adapters()

def enable_adapters(self):
self.model.enable_adapters()

def get_adapter_state_dict(self, adapter_name='adapter'):
return self.model.get_adapter_state_dict(adapter_name)

@classmethod
def from_pretrained(
cls, model_name_or_path: str, config=None, **kwargs
Expand Down

0 comments on commit e417e85

Please sign in to comment.