Skip to content

Commit 4f0b011

Browse files
Hchnryefubao
authored andcommitted
Add omniinfer as a new backend (FlagOpen#630)
Import a new backend called OmniInfer and create an installation script for it. The deployment and inference processes will be the same as those used with VLLM. Patch details: 1. Apply `dos2unix()` to all files. 2. Change permissions to executable (`chmod a+x`) for all shell scripts. 3. Loosen restrictions on the Python version in `pyproject.toml`. 4. Complete the VLLM unpatching in `omni_infer`, as unpatching is currently tricky and depends on VLLM at commit @65334ef3.
1 parent f57719c commit 4f0b011

File tree

4 files changed

+52
-0
lines changed

4 files changed

+52
-0
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@
1616
[submodule "third_party/sglang"]
1717
path = third_party/sglang
1818
url = https://github.com/sgl-project/sglang.git
19+
[submodule "third_party/omniinfer"]
20+
path = third_party/omniinfer
21+
url = https://gitee.com/omniai/omniinfer.git

install/install-requirements.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@ print_help() {
1212
# Initialize the variable
1313
env=""
1414
llama_cpp_backend="cpu"
15+
omni_infer="0"
1516

1617
# Parse command-line options
1718
while [[ "$#" -gt 0 ]]; do
1819
case $1 in
1920
--env) env="$2"; shift ;; # Assign the value after '--env'
2021
--llama-cpp-backend) llama_cpp_backend="$2"; shift ;; # Assign the value after '--llama-cpp-backend'
22+
--omni_infer) omni_infer="$2"; shift ;; # Assign the value after '--llama-cpp-backend'
2123
--help|-h) print_help; exit 0 ;;
2224
*) echo "Error: Unknown parameter passed."; print_help; exit 1 ;;
2325
esac
@@ -193,6 +195,7 @@ if [ "${env}" == "inference" ]; then
193195
# Unpatch
194196
python tools/patch/unpatch.py --backend vllm
195197
python tools/patch/unpatch.py --backend llama.cpp
198+
python tools/patch/unpatch.py --backend omniinfer
196199

197200
# Build vllm
198201
# Navigate to requirements directory and install inference dependencies
@@ -257,6 +260,49 @@ if [ "${env}" == "inference" ]; then
257260
;;
258261
esac
259262

263+
cd ../..
264+
# Build omniinfer
265+
if [ "${omni_infer}" == "1" ]; then
266+
# process repo
267+
find ./third_party/omniinfer -type f -exec dos2unix {} +
268+
find ./third_party/omniinfer -type f -path '*.sh' -exec chmod a+x {} \;
269+
270+
# unpatch vllm
271+
cd ./third_party/omniinfer/infer_engines/
272+
git clone https://github.com/vllm-project/vllm.git
273+
git checkout 65334ef3
274+
bash bash_install_code.sh
275+
cd ../../..
276+
277+
# install dependencies
278+
pip install -r ./third_party/omniinfer/tests/requirements.txt
279+
280+
# build whl for vllm
281+
mkdir -p ./third_party/omniinfer/build/dist
282+
cd ./third_party/omniinfer/infer_engines/vllm
283+
VLLM_TARGET_DEVICE=empty python setup.py bdist_wheel
284+
mv dist/vllm* ../../build/dist
285+
286+
# build whl for omniinfer
287+
cd ../..
288+
pip install build
289+
python -m build
290+
mv dist/omni_i* ./build/dist
291+
292+
# build whl for omniinfer omni_placement
293+
cd ./omni/accelerators/placement
294+
python setup.py bdist_wheel
295+
mv dist/omni_placement* ../../../build/dist
296+
297+
# install 3 whl
298+
cd ../../../build/dist
299+
pip install omni_i*.whl
300+
pip install vllm*.whl
301+
pip install omni_placement*.whl
302+
303+
cd ../../../..
304+
fi
305+
260306
# For FlagRelease
261307
pip install --no-build-isolation git+https://github.com/FlagOpen/FlagGems.git@release_v1.0.0
262308
fi

third_party/omniinfer

Submodule omniinfer added at 6f79695

tools/patch/patch.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,8 @@ def normalize_backend(backend):
455455
return "sglang"
456456
elif input_lower in ["llama.cpp", "llama_cpp"]:
457457
return "llama.cpp"
458+
elif input_lower in ["omniinfer", "omni_infer", "OmniInfer"]:
459+
return "omniinfer"
458460

459461
raise ValueError(f'Unsupported backend {backend}')
460462

0 commit comments

Comments
 (0)