Skip to content

Commit 5f881ac

Browse files
authored
fix baichuan2 bug (#357)
1 parent fac1035 commit 5f881ac

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

swift/llm/utils/model.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,11 @@ def get_model_tokenizer_baichuan2(model_dir: str,
540540
load_model: bool = True,
541541
model_config=None,
542542
**kwargs):
543+
if model_config is None:
544+
model_config = AutoConfig.from_pretrained(
545+
model_dir, trust_remote_code=True)
546+
if not hasattr(model_config, 'z_loss_weight'):
547+
model_config.z_loss_weight = 0
543548
model, tokenizer = get_model_tokenizer_from_repo(
544549
model_dir,
545550
torch_dtype,

0 commit comments

Comments
 (0)