LLM: support starcoder in llm-cli (#8377)
* support starcoder in cli * small fix
This commit is contained in:
parent
50af0251e4
commit
7296453f07
4 changed files with 20 additions and 1 deletions
|
|
@ -53,6 +53,12 @@ function gptneox {
|
||||||
eval "$command"
|
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
|
# Remove model_family/x parameter
|
||||||
filteredArguments=()
|
filteredArguments=()
|
||||||
while [[ $# -gt 0 ]]; do
|
while [[ $# -gt 0 ]]; do
|
||||||
|
|
@ -91,6 +97,8 @@ elif [[ "$model_family" == "bloom" ]]; then
|
||||||
bloom
|
bloom
|
||||||
elif [[ "$model_family" == "gptneox" ]]; then
|
elif [[ "$model_family" == "gptneox" ]]; then
|
||||||
gptneox
|
gptneox
|
||||||
|
elif [[ "$model_family" == "starcoder" ]]; then
|
||||||
|
starcoder
|
||||||
else
|
else
|
||||||
echo "Invalid model_family: $model_family"
|
echo "Invalid model_family: $model_family"
|
||||||
display_help
|
display_help
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,13 @@ function gptneox
|
||||||
Invoke-Expression $command
|
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
|
# Remove model_family/x parameter
|
||||||
$filteredArguments = @()
|
$filteredArguments = @()
|
||||||
for ($i = 0; $i -lt $args.Length; $i++) {
|
for ($i = 0; $i -lt $args.Length; $i++) {
|
||||||
|
|
@ -79,6 +86,9 @@ switch ($model_family)
|
||||||
"gptneox" {
|
"gptneox" {
|
||||||
gptneox
|
gptneox
|
||||||
}
|
}
|
||||||
|
"starcoder" {
|
||||||
|
starcoder
|
||||||
|
}
|
||||||
default {
|
default {
|
||||||
Write-Host "Invalid model_family: $model_family"
|
Write-Host "Invalid model_family: $model_family"
|
||||||
Display-Help
|
Display-Help
|
||||||
|
|
|
||||||
|
|
@ -22,3 +22,4 @@
|
||||||
from bigdl.llm.ggml.model.llama import Llama
|
from bigdl.llm.ggml.model.llama import Llama
|
||||||
from bigdl.llm.ggml.model.gptneox import Gptneox
|
from bigdl.llm.ggml.model.gptneox import Gptneox
|
||||||
from bigdl.llm.ggml.model.bloom import Bloom
|
from bigdl.llm.ggml.model.bloom import Bloom
|
||||||
|
from bigdl.llm.ggml.model.starcoder import Starcoder
|
||||||
|
|
|
||||||
|
|
@ -1427,7 +1427,7 @@ def _convert_starcoder_hf_to_ggml(model_path, outfile_dir, outtype):
|
||||||
model = AutoModelForCausalLM.from_pretrained(model_path, config=config,
|
model = AutoModelForCausalLM.from_pretrained(model_path, config=config,
|
||||||
torch_dtype=torch.float16
|
torch_dtype=torch.float16
|
||||||
if outtype == "f16" else torch.float32,
|
if outtype == "f16" else torch.float32,
|
||||||
low_cpu_mem_usage=True,
|
# low_cpu_mem_usage=True,
|
||||||
trust_remote_code=True,
|
trust_remote_code=True,
|
||||||
offload_state_dict=True)
|
offload_state_dict=True)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue