[LLM] change chatglm native int4 checkpoint name (#8851)

This commit is contained in:
Yishuo Wang 2023-08-30 15:05:19 +08:00 committed by GitHub
parent 954ef954b6
commit bba73ec9d2
2 changed files with 5 additions and 3 deletions

View file

@ -413,8 +413,8 @@ def main():
help="Model name or path used in AutoModel.from_pretrained", help="Model name or path used in AutoModel.from_pretrained",
) )
parser.add_argument( parser.add_argument(
"-o", "--save_path", default="chatglm-ggml.bin", "-o", "--save_path", default="",
type=Path, help="Path to save the generated GGML model" type=str, help="Path to save the generated GGML model"
) )
parser.add_argument( parser.add_argument(
"-t", "-t",
@ -426,6 +426,8 @@ def main():
) )
args = parser.parse_args() args = parser.parse_args()
if args.save_path == "":
args.save_path = f"bigdl_llm_chatglm_{args.type.lower()}.bin"
ggml_type = GGMLType[args.type.upper()] ggml_type = GGMLType[args.type.upper()]
tokenizer = AutoTokenizer.from_pretrained(args.model_name_or_path, trust_remote_code=True) tokenizer = AutoTokenizer.from_pretrained(args.model_name_or_path, trust_remote_code=True)
model = AutoModel.from_pretrained(args.model_name_or_path, trust_remote_code=True) model = AutoModel.from_pretrained(args.model_name_or_path, trust_remote_code=True)

View file

@ -1778,7 +1778,7 @@ def _convert_starcoder_hf_to_ggml(model_path, outfile_dir, outtype):
def _convert_chatglm_hf_to_ggml(model_path, outfile_dir, outtype): def _convert_chatglm_hf_to_ggml(model_path, outfile_dir, outtype):
filestem = Path(model_path).stem filestem = Path(model_path).stem
outfile = os.path.join(outfile_dir, f"ggml-{filestem}-{outtype}.bin") outfile = os.path.join(outfile_dir, f"bigdl_llm_chatglm_{outtype}.bin")
invalidInputError(outtype in ["q4_0", "q4_1"], invalidInputError(outtype in ["q4_0", "q4_1"],
"For now we only support quantization type 'q4_0' and 'q4_1' " "For now we only support quantization type 'q4_0' and 'q4_1' "
"in chatglm family.") "in chatglm family.")