fix typos in llm_convert (#8355)
This commit is contained in:
		
							parent
							
								
									4d177ca0a1
								
							
						
					
					
						commit
						d4027d7164
					
				
					 2 changed files with 6 additions and 4 deletions
				
			
		| 
						 | 
					@ -39,7 +39,7 @@ Here is an example to use `llm-convert` command line tool.
 | 
				
			||||||
# pth model
 | 
					# pth model
 | 
				
			||||||
llm-convert "/path/to/llama-7b-hf/" --model-format pth --outfile "/path/to/llama-7b-int4/" --model-family "llama"
 | 
					llm-convert "/path/to/llama-7b-hf/" --model-format pth --outfile "/path/to/llama-7b-int4/" --model-family "llama"
 | 
				
			||||||
# gptq model
 | 
					# 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.
 | 
					Here is an example to use `llm_convert` python API.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -23,9 +23,9 @@ import argparse
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def _special_kwarg_check(kwargs, check_args):
 | 
					def _special_kwarg_check(kwargs, check_args):
 | 
				
			||||||
    _used_args = {}
 | 
					    _used_args = {}
 | 
				
			||||||
    for arg in check_args:
 | 
					    for arg in kwargs:
 | 
				
			||||||
        if arg not in kwargs:
 | 
					        if arg not in check_args:
 | 
				
			||||||
            return False, {arg, kwargs[arg]}
 | 
					            return False, {arg: kwargs[arg]}
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            _used_args[arg] = kwargs[arg]
 | 
					            _used_args[arg] = kwargs[arg]
 | 
				
			||||||
    return True, _used_args
 | 
					    return True, _used_args
 | 
				
			||||||
| 
						 | 
					@ -47,6 +47,7 @@ def llm_convert(model,
 | 
				
			||||||
                           dtype=outtype,
 | 
					                           dtype=outtype,
 | 
				
			||||||
                           **_used_args,
 | 
					                           **_used_args,
 | 
				
			||||||
                           )
 | 
					                           )
 | 
				
			||||||
 | 
					        return outfile
 | 
				
			||||||
    elif model_format == "gptq":
 | 
					    elif model_format == "gptq":
 | 
				
			||||||
        invalidInputError(model.endswith(".pt"), "only support pytorch's .pt format now.")
 | 
					        invalidInputError(model.endswith(".pt"), "only support pytorch's .pt format now.")
 | 
				
			||||||
        invalidInputError(model_family == "llama" and outtype == 'int4',
 | 
					        invalidInputError(model_family == "llama" and outtype == 'int4',
 | 
				
			||||||
| 
						 | 
					@ -63,6 +64,7 @@ def llm_convert(model,
 | 
				
			||||||
        convert_gptq2ggml(input_path=model,
 | 
					        convert_gptq2ggml(input_path=model,
 | 
				
			||||||
                          tokenizer_path=_used_args["tokenizer_path"],
 | 
					                          tokenizer_path=_used_args["tokenizer_path"],
 | 
				
			||||||
                          output_path=outfile)
 | 
					                          output_path=outfile)
 | 
				
			||||||
 | 
					        return outfile
 | 
				
			||||||
    else:
 | 
					    else:
 | 
				
			||||||
        invalidInputError(False, f"Unsupported input model_type: {model_format}")
 | 
					        invalidInputError(False, f"Unsupported input model_type: {model_format}")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue