LLM: support starcoder in llm-cli (#8377)

* support starcoder in cli

* small fix
This commit is contained in:
Ruonan Wang 2023-06-21 14:38:30 +08:00 committed by GitHub
parent 50af0251e4
commit 7296453f07
4 changed files with 20 additions and 1 deletions

View file

@ -53,6 +53,12 @@ function gptneox {
eval "$command"
}
function starcoder {
command="$lib_dir/main-starcoder_$avx_flag -t $threads -n $n_predict ${filteredArguments[*]}"
echo "$command"
eval "$command"
}
# Remove model_family/x parameter
filteredArguments=()
while [[ $# -gt 0 ]]; do
@ -91,6 +97,8 @@ elif [[ "$model_family" == "bloom" ]]; then
bloom
elif [[ "$model_family" == "gptneox" ]]; then
gptneox
elif [[ "$model_family" == "starcoder" ]]; then
starcoder
else
echo "Invalid model_family: $model_family"
display_help

View file

@ -40,6 +40,13 @@ function gptneox
Invoke-Expression $command
}
function starcoder
{
$command = "$lib_dir/main-starcoder.exe -t $threads -n $n_predict $filteredArguments"
Write-Host "$command"
Invoke-Expression $command
}
# Remove model_family/x parameter
$filteredArguments = @()
for ($i = 0; $i -lt $args.Length; $i++) {
@ -79,6 +86,9 @@ switch ($model_family)
"gptneox" {
gptneox
}
"starcoder" {
starcoder
}
default {
Write-Host "Invalid model_family: $model_family"
Display-Help

View file

@ -22,3 +22,4 @@
from bigdl.llm.ggml.model.llama import Llama
from bigdl.llm.ggml.model.gptneox import Gptneox
from bigdl.llm.ggml.model.bloom import Bloom
from bigdl.llm.ggml.model.starcoder import Starcoder

View file

@ -1427,7 +1427,7 @@ def _convert_starcoder_hf_to_ggml(model_path, outfile_dir, outtype):
model = AutoModelForCausalLM.from_pretrained(model_path, config=config,
torch_dtype=torch.float16
if outtype == "f16" else torch.float32,
low_cpu_mem_usage=True,
# low_cpu_mem_usage=True,
trust_remote_code=True,
offload_state_dict=True)