diff --git a/convert-hf-to-gguf.py b/convert-hf-to-gguf.py index e74aa3a4a..ffbd8448c 100755 --- a/convert-hf-to-gguf.py +++ b/convert-hf-to-gguf.py @@ -2885,6 +2885,29 @@ def main() -> None: print(f"Model successfully exported to '{fname_out}'") +def main_dbg(): + dir_model = Path("d:/models/phi3") + fname_out = Path("c:/models/phi3_fp16.gguf") + + print(f"Loading model: {dir_model.name}") + + hparams = Model.load_hparams(dir_model) + + with torch.inference_mode(): + model_class = Model.from_model_architecture(hparams["architectures"][0]) + model_instance = model_class(dir_model, gguf.GGMLQuantizationType.F16, fname_out, None) + + print("Set model parameters") + model_instance.set_gguf_parameters() + + print("Set model tokenizer") + model_instance.set_vocab() + + print(f"Exporting model to '{fname_out}'") + model_instance.write() + + print(f"Model successfully exported to '{fname_out}'") + if __name__ == '__main__': - main() + main_dbg()