diff --git a/python/llm/README.md b/python/llm/README.md index 277cc37f..5d5d1a85 100644 --- a/python/llm/README.md +++ b/python/llm/README.md @@ -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. diff --git a/python/llm/src/bigdl/llm/convert_model.py b/python/llm/src/bigdl/llm/convert_model.py index 2da473ed..fe038d91 100644 --- a/python/llm/src/bigdl/llm/convert_model.py +++ b/python/llm/src/bigdl/llm/convert_model.py @@ -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}")