Skip to content

Commit f2b08f6

Browse files
committed
convert-hf-to-gguf.py: add option to override architecture
Signed-off-by: Giuseppe Scrivano <[email protected]>
1 parent cd8d590 commit f2b08f6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

convert-hf-to-gguf.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2571,6 +2571,10 @@ def parse_args() -> argparse.Namespace:
25712571
"--no-lazy", action="store_true",
25722572
help="use more RAM by computing all outputs before writing (use in case lazy evaluation is broken)",
25732573
)
2574+
parser.add_argument(
2575+
"--architecture", type=str, default=None,
2576+
help="force the architecture to use",
2577+
)
25742578
parser.add_argument(
25752579
"--model-name", type=str, default=None,
25762580
help="name of the model",
@@ -2626,7 +2630,7 @@ def main() -> None:
26262630
hparams = Model.load_hparams(dir_model)
26272631

26282632
with torch.inference_mode():
2629-
model_class = Model.from_model_architecture(hparams["architectures"][0])
2633+
model_class = Model.from_model_architecture(args.architecture if args.architecture is not None else hparams["architectures"][0])
26302634
model_instance = model_class(dir_model, ftype_map[args.outtype], fname_out, args.bigendian, args.use_temp_file, args.no_lazy)
26312635

26322636
logger.info("Set model parameters")

0 commit comments

Comments
 (0)