From 66afb76a15cb0f930baab850e77cc16d0cdfd029 Mon Sep 17 00:00:00 2001 From: Wing Lian Date: Fri, 7 Jul 2023 21:31:02 -0400 Subject: [PATCH 1/2] don't use llama if trust_remote_code is set since that needs to use AutoModel path --- src/axolotl/utils/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/axolotl/utils/models.py b/src/axolotl/utils/models.py index 6d94cd674..95311ca2b 100644 --- a/src/axolotl/utils/models.py +++ b/src/axolotl/utils/models.py @@ -202,7 +202,7 @@ def load_model( else True, ) load_in_8bit = False - elif cfg.is_llama_derived_model: + elif cfg.is_llama_derived_model and not cfg.trust_remote_code: from transformers import LlamaForCausalLM config = LlamaConfig.from_pretrained(base_model_config) From d69da99c2c43c035c5ee7a425ad9c85aeef81dfb Mon Sep 17 00:00:00 2001 From: Wing Lian Date: Fri, 7 Jul 2023 21:33:11 -0400 Subject: [PATCH 2/2] skip explicit model type too if using trust_remote_code --- src/axolotl/utils/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/axolotl/utils/models.py b/src/axolotl/utils/models.py index 95311ca2b..7181cca31 100644 --- a/src/axolotl/utils/models.py +++ b/src/axolotl/utils/models.py @@ -241,7 +241,7 @@ def load_model( # device=cfg.device, # ) # model.train() # sets to train instead of eval mode - elif model_type: + elif model_type and not cfg.trust_remote_code: model = getattr(transformers, model_type).from_pretrained( base_model, load_in_8bit=cfg.load_in_8bit and cfg.adapter is not None,