From b4c7dd3ac5615ccb52d7627db635d33336e51951 Mon Sep 17 00:00:00 2001 From: hoshi-hiyouga Date: Wed, 23 Oct 2024 20:49:44 +0800 Subject: [PATCH] fix #5797 --- src/llamafactory/model/loader.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/llamafactory/model/loader.py b/src/llamafactory/model/loader.py index 7613c09250..78e2d234eb 100644 --- a/src/llamafactory/model/loader.py +++ b/src/llamafactory/model/loader.py @@ -153,8 +153,9 @@ def load_model( load_class = AutoModelForVision2Seq else: load_class = AutoModelForCausalLM + if model_args.train_from_scratch: - model = load_class.from_config(config) + model = load_class.from_config(config, trust_remote_code=True) else: model = load_class.from_pretrained(**init_kwargs)