fix typos in llm_convert (#8355)

This commit is contained in:
Zhao Changmin 2023-06-19 16:17:21 +08:00 committed by GitHub
parent 4d177ca0a1
commit d4027d7164
2 changed files with 6 additions and 4 deletions

View file

@ -39,7 +39,7 @@ Here is an example to use `llm-convert` command line tool.
# pth model
llm-convert "/path/to/llama-7b-hf/" --model-format pth --outfile "/path/to/llama-7b-int4/" --model-family "llama"
# gptq model
llm-convert "/path/to/vicuna-13B-1.1-GPTQ-4bit-128g.pt" --model-format gptq -outfile "/path/to/out.bin" --tokenizer-path "/path/to/tokenizer.model" --model-family "llama"
llm-convert "/path/to/vicuna-13B-1.1-GPTQ-4bit-128g.pt" --model-format gptq --outfile "/path/to/out.bin" --tokenizer-path "/path/to/tokenizer.model" --model-family "llama"
```
Here is an example to use `llm_convert` python API.

View file

@ -23,9 +23,9 @@ import argparse
def _special_kwarg_check(kwargs, check_args):
_used_args = {}
for arg in check_args:
if arg not in kwargs:
return False, {arg, kwargs[arg]}
for arg in kwargs:
if arg not in check_args:
return False, {arg: kwargs[arg]}
else:
_used_args[arg] = kwargs[arg]
return True, _used_args
@ -47,6 +47,7 @@ def llm_convert(model,
dtype=outtype,
**_used_args,
)
return outfile
elif model_format == "gptq":
invalidInputError(model.endswith(".pt"), "only support pytorch's .pt format now.")
invalidInputError(model_family == "llama" and outtype == 'int4',
@ -63,6 +64,7 @@ def llm_convert(model,
convert_gptq2ggml(input_path=model,
tokenizer_path=_used_args["tokenizer_path"],
output_path=outfile)
return outfile
else:
invalidInputError(False, f"Unsupported input model_type: {model_format}")