Skip to content

Commit

Permalink
[CPP Graph] Support StarCoder-15.5B inference (#1158)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhentaoyu committed Jul 31, 2023
1 parent f19ec15 commit e4eb09f
Show file tree
Hide file tree
Showing 6 changed files with 1,424 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ python scripts/convert_falcon.py ${input_model_name_or_path} --outtype f32 --out

./build/bin/quant_falcon --model_file ${output_path}/ne-f32.bin --out_file ${output_path}/ne-q4_j.bin --bits 4

# convert the pytorch starcoder model to llama.cpp format
python scripts/convert_starcoder.py --model={input_model_name_or_path} --outfile={output_path}/ne-fp32.bin --outtype=fp32

./build/bin/quant_starcoder --model_file ${output_path}/ne-f32.bin --out_file ${output_path}/ne-q4_j.bin --bits 4
```

### Run Models
Expand All @@ -52,7 +56,8 @@ Running LLAMA model, for details please refer to [LLaMA model documentation](./a
OMP_NUM_THREADS=56 numactl -m 0 -C 0-55 ./build/bin/main_llama -m ~/llama.cpp/models/ne-model-q4_j.bin --seed 12 -c 512 -b 1024 -n 256 --keep 48 -t 56 --repeat-penalty 1.0 --color -p "She opened the door and see"
```

Running GPT-NEOX/ MPT / FALCON / GPT-J model, please use `main_gptneox` / `main_mpt` / `main_falcon` / `main_gptj`.
Running GPT-NEOX / MPT / FALCON / / GPT-J / STARCODER model, please use `main_gptneox` / `main_mpt` / `main_falcon` / `main_starcoder` (Please type **prompt about codes** when use `STARCODER`. For example, `-p "def fibonnaci("`).


```bash
OMP_NUM_THREADS=56 numactl -m 0 -C 0-55 ./build/bin/main_gptneox -m ${output_path}/ne-q8.bin --seed 12 -c 512 -b 1024 -n 256 -t 56 --repeat-penalty 1.0 -p "She opened the door and see"
Expand All @@ -67,4 +72,4 @@ python gptj_binding.py
```

### Supported model
Now we supports [GPT-NeoX](https://github.com/EleutherAI/gpt-neox), [LLaMA](https://github.com/facebookresearch/llama), [MPT](https://huggingface.co/mosaicml/mpt-7b), [FALCON](https://huggingface.co/tiiuae/falcon-7b), [GPT-J](https://huggingface.co/docs/transformers/model_doc/gptj)
Now we supports [GPT-NeoX](https://github.com/EleutherAI/gpt-neox), [LLaMA](https://github.com/facebookresearch/llama), [MPT](https://huggingface.co/mosaicml/mpt-7b), [FALCON](https://huggingface.co/tiiuae/falcon-7b), [STARCODER](https://huggingface.co/bigcode/starcoder), [GPT-J](https://huggingface.co/docs/transformers/model_doc/gptj).
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@ add_subdirectory(ChatLLAMA)
add_subdirectory(ChatGPTNEOX)
add_subdirectory(ChatMPT)
add_subdirectory(ChatFALCON)
add_subdirectory(ChatSTARCODER)
add_subdirectory(ChatGPTJ)
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright (c) 2023 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set(TARGET main_starcoder)
add_executable_w_warning(${TARGET} main_starcoder.cpp)
target_link_libraries(${TARGET} PUBLIC ne_layers common ${CMAKE_THREAD_LIBS_INIT})
target_compile_features(${TARGET} PRIVATE cxx_std_11)
if(TARGET BUILD_INFO)
add_dependencies(${TARGET} BUILD_INFO)
endif()

set(TARGET quant_starcoder)
add_executable_w_warning(${TARGET} quant_starcoder.cpp)
target_link_libraries(${TARGET} PUBLIC ne_layers common ${CMAKE_THREAD_LIBS_INIT})
target_compile_features(${TARGET} PRIVATE cxx_std_11)
if(TARGET BUILD_INFO)
add_dependencies(${TARGET} BUILD_INFO)
endif()

0 comments on commit e4eb09f

Please sign in to comment.