Skip to content

Commit 8010445

Browse files
committed
Assume tied weights if lm_head/output weights is missing.
Copy the embd_tokens weights as GGUF has no direct support for tied weights. This is to support model configurations with "tie_word_embeddings" set to true.
1 parent c29af7e commit 8010445

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

convert.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1467,6 +1467,10 @@ def main(args_in: list[str] | None = None) -> None:
14671467

14681468
model = model_plus.model
14691469
model = convert_model_names(model, params, args.skip_unknown)
1470+
1471+
if 'output.weight' not in model:
1472+
model['output.weight'] = model['token_embd.weight']
1473+
14701474
ftype = pick_output_type(model, args.outtype)
14711475
model = convert_to_output_type(model, ftype)
14721476
outfile = args.outfile or default_outfile(model_plus.paths, ftype)

0 commit comments

Comments
 (0)