Skip to content

Commit 1fc902f

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

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
@@ -2564,6 +2564,10 @@ def parse_args() -> argparse.Namespace:
25642564
"--no-lazy", action="store_true",
25652565
help="use more RAM by computing all outputs before writing (use in case lazy evaluation is broken)",
25662566
)
2567+
parser.add_argument(
2568+
"--architecture", type=str, default=None,
2569+
help="force the architecture to use",
2570+
)
25672571
parser.add_argument(
25682572
"--model-name", type=str, default=None,
25692573
help="name of the model",
@@ -2619,7 +2623,7 @@ def main() -> None:
26192623
hparams = Model.load_hparams(dir_model)
26202624

26212625
with torch.inference_mode():
2622-
model_class = Model.from_model_architecture(hparams["architectures"][0])
2626+
model_class = Model.from_model_architecture(args.architecture if args.architecture is not None else hparams["architectures"][0])
26232627
model_instance = model_class(dir_model, ftype_map[args.outtype], fname_out, args.bigendian, args.use_temp_file, args.no_lazy)
26242628

26252629
logger.info("Set model parameters")

0 commit comments

Comments
 (0)