Skip to content

Commit b2d4aff

Browse files
authored
add uv to fix vllm transformers install (#59)
* add uv to fix vllm transformers install Signed-off-by: JaredforReal <w13431838023@gmail.com> * add comments Signed-off-by: JaredforReal <w13431838023@gmail.com> * uv install Signed-off-by: JaredforReal <w13431838023@gmail.com> --------- Signed-off-by: JaredforReal <w13431838023@gmail.com>
1 parent f23992b commit b2d4aff

File tree

2 files changed

+25
-15
lines changed

2 files changed

+25
-15
lines changed

README.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,17 @@ We provide an SDK for using GLM-OCR more efficiently and conveniently.
3535

3636
### Install SDK
3737

38+
> [UV Installation](https://docs.astral.sh/uv/getting-started/installation/)
39+
3840
```bash
3941
# Install from source
4042
git clone https://github.com/zai-org/glm-ocr.git
41-
cd glm-ocr && pip install -e .
43+
cd glm-ocr
44+
uv venv --python 3.12 --seed && source .venv/bin/activate
45+
uv pip install -e .
4246

4347
# Install transformers from source
44-
pip install git+https://github.com/huggingface/transformers.git
48+
uv pip install git+https://github.com/huggingface/transformers.git
4549
```
4650

4751
### Model Deployment
@@ -83,15 +87,16 @@ Deploy the GLM-OCR model locally for full control. The SDK provides the complete
8387
Install vLLM:
8488

8589
```bash
86-
pip install -U vllm --extra-index-url https://wheels.vllm.ai/nightly
90+
uv pip install -U vllm --torch-backend=auto --extra-index-url https://wheels.vllm.ai/nightly
8791
# Or use Docker
8892
docker pull vllm/vllm-openai:nightly
8993
```
9094

9195
Launch the service:
9296

9397
```bash
94-
pip install git+https://github.com/huggingface/transformers.git
98+
# In docker container, uv may not be need for transformers install
99+
uv pip install git+https://github.com/huggingface/transformers.git
95100
96101
# Run with MTP for better performance
97102
vllm serve zai-org/GLM-OCR --allowed-local-media-path / --port 8080 --speculative-config '{"method": "mtp", "num_speculative_tokens": 1}'
@@ -104,13 +109,14 @@ Install SGLang:
104109
```bash
105110
docker pull lmsysorg/sglang:dev
106111
# Or build from source
107-
pip install git+https://github.com/sgl-project/sglang.git#subdirectory=python
112+
uv pip install git+https://github.com/sgl-project/sglang.git#subdirectory=python
108113
```
109114

110115
Launch the service:
111116

112117
```bash
113-
pip install git+https://github.com/huggingface/transformers.git
118+
# In docker container, uv may not be need for transformers install
119+
uv pip install git+https://github.com/huggingface/transformers.git
114120
115121
# Run with MTP for better performance
116122
python -m sglang.launch_server --model zai-org/GLM-OCR --port 8080 --speculative-algorithm NEXTN --speculative-num-steps 3 --speculative-eagle-topk 1 --speculative-num-draft-tokens 4

README_zh.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,17 @@ GLM-OCR 是一款面向复杂文档理解的多模态 OCR 模型,基于 GLM-V
3535

3636
### 安装 SDK
3737

38-
```bash
39-
pip install glmocr
38+
> [UV 安装](https://docs.astral.sh/uv/getting-started/installation/)
4039
41-
# 或从源码安装
40+
```bash
41+
# 从源码安装
4242
git clone https://github.com/zai-org/glm-ocr.git
43-
cd glm-ocr && pip install -e .
43+
cd glm-ocr
44+
uv venv --python 3.12 --seed && source .venv/bin/activate
45+
uv pip install -e .
4446

4547
# 从源码安装 transformers
46-
pip install git+https://github.com/huggingface/transformers.git
48+
uv pip install git+https://github.com/huggingface/transformers.git
4749
```
4850

4951
### 模型服务部署
@@ -85,15 +87,16 @@ API 文档:https://docs.bigmodel.cn/cn/guide/models/vlm/glm-ocr
8587
安装 vLLM:
8688

8789
```bash
88-
pip install -U vllm --extra-index-url https://wheels.vllm.ai/nightly
90+
uv pip install -U vllm --torch-backend=auto --extra-index-url https://wheels.vllm.ai/nightly
8991
# 或使用 Docker
9092
docker pull vllm/vllm-openai:nightly
9193
```
9294

9395
启动服务:
9496

9597
```bash
96-
pip install git+https://github.com/huggingface/transformers.git
98+
# 在 docker 容器中,或许不在需要 uv 来安装transformers
99+
uv pip install git+https://github.com/huggingface/transformers.git
97100
vllm serve zai-org/GLM-OCR --allowed-local-media-path / --port 8080
98101
99102
# 打开MTP,获得更好的推理性能
@@ -107,13 +110,14 @@ vllm serve zai-org/GLM-OCR --allowed-local-media-path / --port 8080 --speculativ
107110
```bash
108111
docker pull lmsysorg/sglang:dev
109112
# 或从源码安装
110-
pip install git+https://github.com/sgl-project/sglang.git#subdirectory=python
113+
uv pip install git+https://github.com/sgl-project/sglang.git#subdirectory=python
111114
```
112115

113116
启动服务:
114117

115118
```bash
116-
pip install git+https://github.com/huggingface/transformers.git
119+
# 在 docker 容器中,或许不在需要 uv 来安装transformers
120+
uv pip install git+https://github.com/huggingface/transformers.git
117121
python -m sglang.launch_server --model zai-org/GLM-OCR --port 8080
118122
119123
# 打开MTP,获得更好的推理性能

0 commit comments

Comments
 (0)