diff --git a/finetune.py b/finetune.py index 084a218..0350855 100644 --- a/finetune.py +++ b/finetune.py @@ -111,7 +111,7 @@ def main(): if noquant: # Load base model - model = AutoModelForCausalLM.from_pretrained(base_model, device_map={"": 0}) + model = AutoModelForCausalLM.from_pretrained(base_model, device_map={"": 0}, trust_remote_code=True) elif quant8: quant_config = BitsAndBytesConfig( load_in_8bit=True, @@ -120,7 +120,7 @@ def main(): bnb_8bit_use_double_quant=False ) # Load base model - model = AutoModelForCausalLM.from_pretrained(base_model, quantization_config=quant_config, device_map={"": 0}) + model = AutoModelForCausalLM.from_pretrained(base_model, quantization_config=quant_config, device_map={"": 0}, trust_remote_code=True) else: # Set up quantization config quant_config = BitsAndBytesConfig( @@ -130,7 +130,7 @@ def main(): bnb_4bit_use_double_quant=True, ) # Load base model - model = AutoModelForCausalLM.from_pretrained(base_model, quantization_config=quant_config, device_map={"": 0}) + model = AutoModelForCausalLM.from_pretrained(base_model, quantization_config=quant_config, device_map={"": 0}, trust_remote_code=True) model.config.use_cache = False model.config.pretraining_tp = 1 @@ -150,6 +150,7 @@ def main(): r=64, bias="none", task_type="CAUSAL_LM", + target_modules = 'all-linear', ) # Pass quant and lora to trainer diff --git a/finetune_dpo.py b/finetune_dpo.py index 8e505a7..10bbe8b 100644 --- a/finetune_dpo.py +++ b/finetune_dpo.py @@ -113,7 +113,7 @@ def main(): if noquant: # Load base model - model = AutoModelForCausalLM.from_pretrained(base_model, device_map={"": 0}) + model = AutoModelForCausalLM.from_pretrained(base_model, device_map={"": 0}, trust_remote_code=True) elif quant8: quant_config = BitsAndBytesConfig( load_in_8bit=True, @@ -122,7 +122,7 @@ def main(): bnb_8bit_use_double_quant=False ) # Load base model - model = AutoModelForCausalLM.from_pretrained(base_model, quantization_config=quant_config, device_map={"": 0}) + model = AutoModelForCausalLM.from_pretrained(base_model, quantization_config=quant_config, device_map={"": 0}, trust_remote_code=True) else: # Set up quantization config quant_config = BitsAndBytesConfig( @@ -132,7 +132,7 @@ def main(): bnb_4bit_use_double_quant=True, ) # Load base model - model = AutoModelForCausalLM.from_pretrained(base_model, quantization_config=quant_config, device_map={"": 0}) + model = AutoModelForCausalLM.from_pretrained(base_model, quantization_config=quant_config, device_map={"": 0}, trust_remote_code=True) model.config.use_cache = False model.config.pretraining_tp = 1 @@ -154,6 +154,7 @@ def main(): r=64, bias="none", task_type="CAUSAL_LM", + target_modules='all-linear', ) # Pass quant and lora to trainer diff --git a/finetune_orpo.py b/finetune_orpo.py index bedaaa0..13b2428 100644 --- a/finetune_orpo.py +++ b/finetune_orpo.py @@ -111,7 +111,7 @@ def main(): if noquant: # Load base model - model = AutoModelForCausalLM.from_pretrained(base_model, device_map={"": 0}) + model = AutoModelForCausalLM.from_pretrained(base_model, device_map={"": 0}, trust_remote_code=True) elif quant8: quant_config = BitsAndBytesConfig( load_in_8bit=True, @@ -120,7 +120,7 @@ def main(): bnb_8bit_use_double_quant=False ) # Load base model - model = AutoModelForCausalLM.from_pretrained(base_model, quantization_config=quant_config, device_map={"": 0}) + model = AutoModelForCausalLM.from_pretrained(base_model, quantization_config=quant_config, device_map={"": 0}, trust_remote_code=True) else: # Set up quantization config quant_config = BitsAndBytesConfig( @@ -130,7 +130,7 @@ def main(): bnb_4bit_use_double_quant=True, ) # Load base model - model = AutoModelForCausalLM.from_pretrained(base_model, quantization_config=quant_config, device_map={"": 0}) + model = AutoModelForCausalLM.from_pretrained(base_model, quantization_config=quant_config, device_map={"": 0}, trust_remote_code=True) model.config.use_cache = False model.config.pretraining_tp = 1 @@ -162,6 +162,7 @@ def main(): report_to=None, remove_unused_columns=False, beta=0.1, # the lambda/alpha hyperparameter in the paper/code + target_modules='all-linear', ) trainer = ORPOTrainer( diff --git a/requirements.txt b/requirements.txt index 3e4150d..a0f3fe3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ accelerate==0.25.0 -peft==0.6.2 +peft==0.10.0 bitsandbytes==0.41.2.post2 transformers==4.36.2 trl==0.8.2