yajunvicky commited on
Commit
824fdca
·
verified ·
1 Parent(s): bfc0417

Initial model upload

Browse files
Files changed (3) hide show
  1. README.md +141 -0
  2. configuration.json +4 -0
  3. image/group.png +0 -0
README.md ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Introduction
2
+
3
+ DeepSeek-R1-Distill-Qwen-32B-FlagOS-Cambricon provides an all-in-one deployment solution, enabling execution of DeepSeek-R1-Distill-Qwen-32B on Cambricon GPUs. As the first-generation release for the Cambricon-MLU590, this package delivers three key features:
4
+
5
+ 1. Comprehensive Integration:
6
+ - Integrated with FlagScale (https://github.com/FlagOpen/FlagScale).
7
+ - Open-source inference execution code, preconfigured with all necessary software and hardware settings.
8
+ - Pre-built Docker image for rapid deployment on Cambricon-MLU590.
9
+ 2. Consistency Validation:
10
+ - Evaluation tests verifying consistency of results between the official and ours.
11
+
12
+ # Technical Summary
13
+
14
+ ## Serving Engine
15
+
16
+ We use FlagScale as the serving engine to improve the portability of distributed inference.
17
+
18
+ FlagScale is an end-to-end framework for large models across multiple chips, maximizing computational resource efficiency while ensuring model effectiveness. It ensures both ease of use and high performance for users when deploying models across different chip architectures:
19
+
20
+ - One-Click Service Deployment: FlagScale provides a unified and simple command execution mechanism, allowing users to fast deploy services seamlessly across various hardware platforms using the same command. This significantly reduces the entry barrier and enhances user experience.
21
+ - Automated Deployment Optimization: FlagScale automatically optimizes distributed parallel strategies based on the computational capabilities of different AI chips, ensuring optimal resource allocation and efficient utilization, thereby improving overall deployment performance.
22
+ - Automatic Operator Library Switching: Leveraging FlagScale's unified Runner mechanism and deep integration with FlagGems, users can seamlessly switch to the FlagGems operator library for inference by simply adding environment variables in the configuration file.
23
+
24
+ ## Triton Support
25
+
26
+ We validate the execution of DeepSeek-R1-Distill-Qwen-32B model with a Triton-based operator library as a PyTorch alternative.
27
+
28
+ We use a variety of Triton-implemented operation kernels—approximately 70%—to run the DeepSeek-R1-Distill-Qwen-32B model. These kernels come from two main sources:
29
+
30
+ - Most Triton kernels are provided by FlagGems (https://github.com/FlagOpen/FlagGems). You can enable FlagGems kernels by setting the environment variable USE_FLAGGEMS. For more details, please refer to the "How to Run Locally" section.
31
+
32
+ - Also included are Triton kernels from vLLM, including fused MoE.
33
+
34
+ # Bundle Download
35
+ Requested by Cambricon, the file of docker image and model files should be applied by email.
36
+
37
+ | | Usage | Cambricon |
38
+ | ----------- | ------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------- |
39
+ | Basic Image | basic software environment that supports model running | ecosystem@cambricon.com <br> Contact by email,please indicate the unit/contact person/contact information/equipment source/specific requirements |
40
+ | Model | model weight and configuration files | ecosystem@cambricon.com <br> Contact by email,please indicate the unit/contact person/contact information/equipment source/specific requirements |
41
+ # Evaluation Results
42
+
43
+ ## Benchmark Result
44
+
45
+ | Metrics | DeepSeek-R1-Distill-Qwen-32B-H100-CUDA | DeepSeek-R1-Distill-Qwen-32B-FlagOS-Cambricon |
46
+ |:-------------------|-----------------------|--------------------------|
47
+ | GSM8K (EM) | 87.64 | 86.81 |
48
+ | MMLU (Acc.) | 79.33 | 79.45 |
49
+ | CEVAL | 83.43 | 83.43 |
50
+ | AIME 2024 (Pass@1) | 73.33 | 70.00 |
51
+ | GPQA-Diamond (Pass@1) | 59.60 | 64.65 |
52
+ | MATH-500 (pass@1) | 92.80 | 93.40 |
53
+
54
+
55
+ # How to Run Locally
56
+ ## 📌 Getting Started
57
+ ### Environment Setup
58
+
59
+ ```bash
60
+ # install FlagScale
61
+ git clone https://github.com/FlagOpen/FlagScale.git
62
+ cd FlagScale
63
+ pip install .
64
+
65
+ # download image and ckpt
66
+ flagscale pull --image <IMAGE> --ckpt <CKPT> --ckpt-path <CKPT_PATH>
67
+
68
+ # Note: For security reasons, this image does not have passwordless configuration. In multi-machine scenarios, you need to configure passwordless access for the image yourself.
69
+
70
+ # build and enter the container
71
+ docker run -e --net=host --pid=host --ipc=host -v /tmp/.X11-unix:/tmp/.X11-unix --privileged -it -v <CKPT_PATH>:<CKPT_PATH> -v /opt/data/:/opt/data/ -v /usr/bin/cnmon:/usr/bin/cnmon --name flagrelease_cambricon <IMAGE> /bin/bash
72
+ ```
73
+
74
+
75
+ ### Download and install FlagGems
76
+
77
+ ```bash
78
+ git clone https://github.com/FlagOpen/FlagGems.git
79
+ cd FlagGems
80
+ git checkout DeepSeek-R1-Distill-Qwen-32B_release_Cambricon
81
+ # no additional dependencies since they are already handled in the Docker environment
82
+ pip install ./ --no-deps
83
+ cd ../
84
+ ```
85
+
86
+ ### Download FlagScale and unpatch the vendor's code to build vllm
87
+
88
+ ```bash
89
+ git clone https://github.com/FlagOpen/FlagScale.git
90
+ cd FlagScale
91
+ # please set the name and email in git config in advance, for example: git config --global user.name "your_name"; git config --global user.email "your_email"
92
+ python tools/patch/unpatch.py --device-type Cambricon --commit-id 57637057 --dir build
93
+ cd build/Cambricon/FlagScale/vllm
94
+ pip install -e . -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
95
+ cd vllm_mlu
96
+ pip install -e . -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
97
+ cd ../../
98
+ ```
99
+ ### Serve
100
+
101
+ ```bash
102
+ # config the DeepSeek-R1-Distill-Qwen-32B yaml
103
+ FlagScale/
104
+ ├── examples/
105
+ │ └── DeepSeek-R1-Distill-Qwen-32B/
106
+ │ └── conf/
107
+ │ └── config_DeepSeek-R1-Distill-Qwen-32B.yaml # set hostfile and ssh_port(optional), if it is passwordless access between containers, the docker field needs to be removed
108
+ │ └── serve/
109
+ │ └── DeepSeek-R1-Distill-Qwen-32B.yaml # set model parameters and server port
110
+
111
+ # install flagscale
112
+ pip install .
113
+ # serve
114
+ flagscale serve DeepSeek-R1-Distill-Qwen-32B
115
+ ```
116
+
117
+ # Usage Recommendations
118
+ When custom service parameters, users can run:
119
+
120
+ ```bash
121
+ flagscale serve <MODEL_NAME> <MODEL_CONFIG_YAML>
122
+ ```
123
+
124
+ # Contributing
125
+
126
+ We warmly welcome global developers to join us:
127
+ 1. Submit Issues to report problems
128
+ 2. Create Pull Requests to contribute code
129
+ 3. Improve technical documentation
130
+ 4. Expand hardware adaptation support
131
+
132
+ # 📞 Contact Us
133
+
134
+ Scan the QR code below to add our WeChat group
135
+ send "FlagRelease"
136
+
137
+ ![WeChat](image/group.png)
138
+
139
+ # License
140
+
141
+ This project and related model weights are licensed under the MIT License.
configuration.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "framework": "Pytorch",
3
+ "task": "any-to-any"
4
+ }
image/group.png ADDED