|
1 | | -# FROM pytorch/pytorch:2.5.1-cuda12.1-cudnn9-devel as compile_server |
2 | | -FROM pytorch/pytorch:2.6.0-cuda12.6-cudnn9-devel as compile_server |
| 1 | +FROM nvcr.io/nvidia/pytorch:25.03-py3 |
3 | 2 |
|
4 | | -ARG CPU_INSTRUCT=NATIVE |
| 3 | +EXPOSE 28000 |
5 | 4 |
|
6 | | -# 设置工作目录和 CUDA 路径 |
7 | | -WORKDIR /workspace |
8 | | -ENV CUDA_HOME=/usr/local/cuda |
| 5 | +ENV TZ=Asia/Shanghai |
| 6 | +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && apt update && apt install python3-tk -y |
9 | 7 |
|
10 | | -# 安装依赖 |
11 | | -RUN apt update -y && apt install -y apt-utils && apt upgrade -y |
12 | | -RUN apt install -y --no-install-recommends \ |
13 | | - libtbb-dev \ |
14 | | - libssl-dev \ |
15 | | - libcurl4-openssl-dev \ |
16 | | - libaio1 \ |
17 | | - libaio-dev \ |
18 | | - libfmt-dev \ |
19 | | - libgflags-dev \ |
20 | | - zlib1g-dev \ |
21 | | - patchelf \ |
22 | | - git \ |
23 | | - wget \ |
24 | | - vim \ |
25 | | - gcc \ |
26 | | - g++ |
| 8 | +RUN mkdir /app |
27 | 9 |
|
28 | | -# 安装CMake |
29 | | -RUN wget https://github.com/Kitware/CMake/releases/download/v4.0.1/cmake-4.0.1-linux-x86_64.sh && echo y | bash cmake-4.0.1-linux-x86_64.sh && rm -rf cmake-4.0.1-linux-x86_64.sh |
| 10 | +WORKDIR /app |
| 11 | +RUN git clone --recurse-submodules https://github.com/Akegarasu/lora-scripts |
30 | 12 |
|
31 | | -# 克隆代码 |
32 | | -RUN git clone https://github.com/kvcache-ai/ktransformers.git |
33 | | -# 清理 apt 缓存 |
34 | | -RUN rm -rf /var/lib/apt/lists/* |
| 13 | +WORKDIR /app/lora-scripts |
| 14 | +RUN pip install xformers==0.0.27.post2 --no-deps && pip install -r requirements.txt |
35 | 15 |
|
36 | | -# 进入项目目录 |
37 | | -WORKDIR /workspace/ktransformers |
38 | | -# 初始化子模块 |
39 | | -RUN git submodule update --init --recursive |
| 16 | +WORKDIR /app/lora-scripts/scripts |
| 17 | +RUN pip install -r requirements.txt |
40 | 18 |
|
41 | | -# 升级 pip |
42 | | -RUN pip install --upgrade pip && pip install -U wheel setuptools |
| 19 | +WORKDIR /app/lora-scripts |
43 | 20 |
|
44 | | -# 安装构建依赖 |
45 | | -RUN pip install ninja pyproject numpy cpufeature aiohttp zmq openai |
46 | | - |
47 | | -# 安装 flash-attn(提前装可以避免后续某些编译依赖出错) |
48 | | -RUN pip install flash-attn |
49 | | - |
50 | | -# 安装 ktransformers 本体(含编译) |
51 | | -RUN CPU_INSTRUCT=${CPU_INSTRUCT} \ |
52 | | - USE_BALANCE_SERVE=1 \ |
53 | | - KTRANSFORMERS_FORCE_BUILD=TRUE \ |
54 | | - TORCH_CUDA_ARCH_LIST="8.0;8.6;8.7;8.9;9.0+PTX" \ |
55 | | - pip install . --no-build-isolation --verbose |
56 | | - |
57 | | -RUN pip install third_party/custom_flashinfer/ |
58 | | -# 清理 pip 缓存 |
59 | | -RUN pip cache purge |
60 | | - |
61 | | -# 拷贝 C++ 运行时库 |
62 | | -RUN cp /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /opt/conda/lib/ |
63 | | - |
64 | | -# 保持容器运行(调试用) |
65 | | -ENTRYPOINT ["tail", "-f", "/dev/null"] |
| 21 | +CMD ["python", "gui.py", "--listen"] |
0 commit comments