maxoul commited on
Commit
6518298
·
verified ·
1 Parent(s): 0d7419b

Update splade.py

Browse files
Files changed (1) hide show
  1. splade.py +3 -1
splade.py CHANGED
@@ -14,6 +14,7 @@ from .utils import (
14
  similarity,
15
  encode,
16
  )
 
17
 
18
 
19
  class SpladeConfig(PretrainedConfig):
@@ -73,7 +74,8 @@ class Splade(PreTrainedModel):
73
  model = cls(config)
74
  local_dir = snapshot_download(model_name_or_path)
75
  adapter_path = os.path.join(local_dir, "lora")
76
- model.model.load_adapter(adapter_path)
 
77
  model.reverse_voc = {v: k for k, v in model.tokenizer.vocab.items()}
78
  return model
79
 
 
14
  similarity,
15
  encode,
16
  )
17
+ from peft import PeftModel
18
 
19
 
20
  class SpladeConfig(PretrainedConfig):
 
74
  model = cls(config)
75
  local_dir = snapshot_download(model_name_or_path)
76
  adapter_path = os.path.join(local_dir, "lora")
77
+ # model.model.load_adapter(adapter_path)
78
+ model.model = PeftModel.from_pretrained(model.model, adapter_path)
79
  model.reverse_voc = {v: k for k, v in model.tokenizer.vocab.items()}
80
  return model
81