Skip to content

Commit

Permalink
Set trust remote code to false by default (huggingface#833)
Browse files Browse the repository at this point in the history
  • Loading branch information
lewtun authored and Andrew Lapp committed May 10, 2024
1 parent 0638141 commit 3e5ba84
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion examples/scripts/reward_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class ScriptArguments:
load_in_8bit: Optional[bool] = field(default=False, metadata={"help": "load the model in 8 bits precision"})
load_in_4bit: Optional[bool] = field(default=False, metadata={"help": "load the model in 4 bits precision"})
use_peft: Optional[bool] = field(default=False, metadata={"help": "Wether to use PEFT or not to train adapters"})
trust_remote_code: Optional[bool] = field(default=True, metadata={"help": "Enable `trust_remote_code`"})
trust_remote_code: Optional[bool] = field(default=False, metadata={"help": "Enable `trust_remote_code`"})
output_dir: Optional[str] = field(default="output", metadata={"help": "the output directory"})


Expand Down
5 changes: 3 additions & 2 deletions examples/scripts/sentiment_tuning.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class ScriptArguments:
task_type="CAUSAL_LM",
),
)
trust_remote_code: bool = field(default=False, metadata={"help": "Enable `trust_remote_code`"})


args = tyro.cli(ScriptArguments)
Expand Down Expand Up @@ -122,7 +123,7 @@ def collator(data):

# Now let's build the model, the reference model, and the tokenizer.
if not args.use_peft:
ref_model = trl_model_class.from_pretrained(args.ppo_config.model_name, trust_remote_code=True)
ref_model = trl_model_class.from_pretrained(args.ppo_config.model_name, trust_remote_code=args.trust_remote_code)
device_map = None
peft_config = None
else:
Expand All @@ -133,7 +134,7 @@ def collator(data):

model = trl_model_class.from_pretrained(
args.ppo_config.model_name,
trust_remote_code=True,
trust_remote_code=args.trust_remote_code,
device_map=device_map,
peft_config=peft_config,
)
Expand Down
2 changes: 1 addition & 1 deletion examples/scripts/sft_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class ScriptArguments:
load_in_8bit: Optional[bool] = field(default=False, metadata={"help": "load the model in 8 bits precision"})
load_in_4bit: Optional[bool] = field(default=False, metadata={"help": "load the model in 4 bits precision"})
use_peft: Optional[bool] = field(default=False, metadata={"help": "Wether to use PEFT or not to train adapters"})
trust_remote_code: Optional[bool] = field(default=True, metadata={"help": "Enable `trust_remote_code`"})
trust_remote_code: Optional[bool] = field(default=False, metadata={"help": "Enable `trust_remote_code`"})
output_dir: Optional[str] = field(default="output", metadata={"help": "the output directory"})
peft_lora_r: Optional[int] = field(default=64, metadata={"help": "the r parameter of the LoRA adapters"})
peft_lora_alpha: Optional[int] = field(default=16, metadata={"help": "the alpha parameter of the LoRA adapters"})
Expand Down

0 comments on commit 3e5ba84

Please sign in to comment.