install.sh 1.54 KB
Newer Older
chenxl's avatar
chenxl committed
1
2
3
#!/bin/bash
set -e  

Alisehen's avatar
Alisehen committed
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# default backend
DEV="cuda"

# parse --dev argument
while [[ "$#" -gt 0 ]]; do
    case $1 in
        --dev) DEV="$2"; shift ;;
        *) echo "Unknown parameter passed: $1"; exit 1 ;;
    esac
    shift
done
export DEV_BACKEND="$DEV"
echo "Selected backend: $DEV_BACKEND"

chenxl's avatar
chenxl committed
18
# clear build dirs
Xie Weiyu's avatar
Xie Weiyu committed
19
20
rm -rf build
rm -rf *.egg-info
21
22
23
24
25
26
rm -rf csrc/build
rm -rf csrc/ktransformers_ext/build
rm -rf csrc/ktransformers_ext/cuda/build
rm -rf csrc/ktransformers_ext/cuda/dist
rm -rf csrc/ktransformers_ext/cuda/*.egg-info
rm -rf ~/.ktransformers
chenxl's avatar
chenxl committed
27
28
echo "Installing python dependencies from requirements.txt"
pip install -r requirements-local_chat.txt
29
pip install -r ktransformers/server/requirements.txt
Alisehen's avatar
Alisehen committed
30

Alisehen's avatar
fix  
Alisehen committed
31
32
33
echo "Installing ktransformers"
KTRANSFORMERS_FORCE_BUILD=TRUE pip install -v . --no-build-isolation

Alisehen's avatar
Alisehen committed
34
35
36
37
38
39
40
# XPU-specific fix for triton
if [[ "$DEV_BACKEND" == "xpu" ]]; then
    echo "Replacing triton for XPU backend"
    pip uninstall -y triton pytorch-triton-xpu || true
    pip install pytorch-triton-xpu==3.3.0 --extra-index-url https://download.pytorch.org/whl/xpu
fi

Alisehen's avatar
Alisehen committed
41
42
43
44
if [[ "$DEV_BACKEND" == "cuda" ]]; then
    echo "Installing custom_flashinfer for CUDA backend"
    pip install third_party/custom_flashinfer/
fi
45
46
47
48
# SITE_PACKAGES=$(python -c "import site; print(site.getsitepackages()[0])")
# echo "Copying thirdparty libs to $SITE_PACKAGES"
# cp -a csrc/balance_serve/build/third_party/prometheus-cpp/lib/libprometheus-cpp-*.so* $SITE_PACKAGES/
# patchelf --set-rpath '$ORIGIN' $SITE_PACKAGES/sched_ext.cpython*
49
50


wang jiahao's avatar
wang jiahao committed
51
echo "Installation completed successfully"