Skip to content

Commit

Permalink
move trust_remote_code to pegasus configurable params
Browse files Browse the repository at this point in the history
  • Loading branch information
leondz committed Nov 12, 2024
1 parent c86a39f commit dd2258c
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions garak/buffs/paraphrase.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ class PegasusT5(Buff, HFCompatible):
DEFAULT_PARAMS = Buff.DEFAULT_PARAMS | {
"para_model_name": "garak-llm/pegasus_paraphrase",
"hf_args": {
"device": "cpu"
"device": "cpu",
"trust_remote_code": False,
}, # torch_dtype doesn't have standard support in Pegasus
"max_length": 60,
"temperature": 1.5,
Expand All @@ -39,13 +40,8 @@ def _load_model(self):
self.para_model = PegasusForConditionalGeneration.from_pretrained(
self.para_model_name
).to(self.device)
trust_remote_code = (
self.hf_args["trust_remote_code"]
if "trust_remote_code" in self.hf_args
else False
)
self.tokenizer = PegasusTokenizer.from_pretrained(
self.para_model_name, trust_remote_code=trust_remote_code
self.para_model_name, trust_remote_code=self.hf_args["trust_remote_code"]
)

def _get_response(self, input_text):
Expand Down

0 comments on commit dd2258c

Please sign in to comment.