Skip to content

Commit 279c5a9

Browse files
author
zhangqi3
committed
[Release] v0.0.5
1 parent b5f2b34 commit 279c5a9

61 files changed

Lines changed: 2106 additions & 132 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

application/imagenet_example/main.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ def main_worker(gpu, ngpus_per_node, args):
162162
# quantize model
163163
if args.quant:
164164
model = prepare_by_platform(model, args.backend)
165-
166165
if not torch.cuda.is_available():
167166
print('using CPU, this will be slow')
168167
elif args.distributed:

docker/Dockerfile

Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
FROM nvidia/cuda:10.0-cudnn7-devel-ubuntu18.04
2+
3+
# Due to bad internet issue
4+
RUN rm /etc/apt/sources.list.d/*
5+
6+
# prepare build dir tmp
7+
RUN chmod 1777 /tmp \
8+
&& mkdir /scratch \
9+
&& chmod 1777 /scratch
10+
11+
# install build needed tools
12+
RUN apt-get update -y \
13+
&& DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata \
14+
&& apt-get install -y --no-install-recommends \
15+
software-properties-common \
16+
apt-transport-https \
17+
autoconf \
18+
automake \
19+
bc \
20+
build-essential \
21+
bzip2 \
22+
ca-certificates \
23+
curl \
24+
g++ \
25+
gdb \
26+
git \
27+
gnupg \
28+
locales \
29+
libboost-all-dev \
30+
libgflags-dev \
31+
libgoogle-glog-dev \
32+
libgtest-dev \
33+
libjson-c-dev \
34+
libjsoncpp-dev \
35+
libssl-dev \
36+
libtool \
37+
libunwind-dev \
38+
make \
39+
openssh-client \
40+
openssl \
41+
# python3 \
42+
python3-dev \
43+
# python3-minimal \
44+
# python3-numpy \
45+
# python3-opencv \
46+
python3-pip \
47+
# python3-setuptools \
48+
# python3-venv \
49+
software-properties-common \
50+
sudo \
51+
tree \
52+
unzip \
53+
vim \
54+
wget \
55+
yasm \
56+
zstd \
57+
libtool
58+
59+
# set python
60+
ENV PYTHONPATH=/opt/python:$PYTHONPATH
61+
ENV LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
62+
63+
ENV PYENV_ROOT=/opt/pyenv \
64+
PATH=/opt/pyenv/shims:/opt/pyenv/bin:$PATH
65+
66+
RUN git clone --depth 1 https://github.com/pyenv/pyenv.git /opt/pyenv \
67+
&& eval "$(pyenv init -)" \
68+
&& env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.6.4 \
69+
&& pyenv global 3.6.4
70+
71+
RUN pip install --upgrade pip
72+
RUN pip install torch==1.8.1 torchvision flake8 scipy pytest
73+
74+
75+
# RUN mkdir /opt/hub && wget https://github.com/pytorch/vision/archive/master.zip -P /opt/hub && unzip /opt/hub/master.zip -d /opt/hub && mv /opt/hub/vision-master/ /opt/hub/pytorch_vision_master
76+
ENV TORCH_HOME=/opt/
77+
78+
RUN apt-get install -y \
79+
libavcodec-dev \
80+
libavformat-dev \
81+
libeigen3-dev \
82+
libgstreamer-plugins-base1.0-dev \
83+
libgstreamer1.0-dev \
84+
libgtest-dev \
85+
libgtk-3-dev \
86+
libgtk2.0-dev \
87+
libhdf5-dev \
88+
libjpeg-dev \
89+
libopenexr-dev \
90+
libpng-dev \
91+
libswscale-dev \
92+
libtiff-dev \
93+
libwebp-dev \
94+
# opencl-clhpp-headers \
95+
# opencl-headers \
96+
# pocl-opencl-icd \
97+
rpm \
98+
&& add-apt-repository -y ppa:ubuntu-toolchain-r/test \
99+
&& apt-get install -y \
100+
gcc-8 \
101+
g++-8 \
102+
gcc-9 \
103+
g++-9 \
104+
&& wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null \
105+
&& apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic main' \
106+
&& apt-get update -y \
107+
&& apt-get install -y \
108+
cmake=3.16.0-0kitware1 \
109+
cmake-data=3.16.0-0kitware1 \
110+
kitware-archive-keyring \
111+
&& apt-get install -y ffmpeg
112+
113+
# set locales
114+
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen \
115+
&& echo "LC_ALL=en_US.UTF-8" >> /etc/environment \
116+
&& echo "LANG=en_US.UTF-8" > /etc/locale.conf \
117+
&& locale-gen en_US.UTF-8 \
118+
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 \
119+
&& apt-get install -y dialog \
120+
&& dpkg-reconfigure --frontend noninteractive locales
121+
122+
123+
# build gtest
124+
RUN cd /usr/src/gtest \
125+
&& mkdir -p build \
126+
&& cd build \
127+
&& cmake .. \
128+
&& make \
129+
&& make install
130+
131+
# set glob
132+
RUN cd /tmp \
133+
&& wget --progress=dot:mega -O glog.0.4.0.tar.gz https://codeload.github.com/google/glog/tar.gz/v0.4.0 \
134+
&& tar -xvf glog.0.4.0.tar.gz \
135+
&& cd glog-0.4.0 \
136+
&& ./autogen.sh \
137+
&& mkdir build \
138+
&& cd build \
139+
&& cmake -DBUILD_SHARED_LIBS=ON .. \
140+
&& make -j 4 \
141+
&& make install \
142+
&& rm -fr /tmp/*
143+
144+
145+
# set protobuf
146+
RUN /tmp; wget --progress=dot:mega https://codeload.github.com/google/protobuf/zip/v3.4.0 \
147+
&& unzip v3.4.0 \
148+
&& cd protobuf-3.4.0 \
149+
&& ./autogen.sh \
150+
&& ./configure \
151+
&& make -j 4 \
152+
&& make install \
153+
&& ldconfig \
154+
&& rm -fr /tmp/*
155+
156+
# set gflag
157+
RUN cd /tmp; wget --progress=dot:mega https://github.com/gflags/gflags/archive/v2.2.2.tar.gz \
158+
&& tar xvf v2.2.2.tar.gz \
159+
&& cd gflags-2.2.2 \
160+
&& mkdir build \
161+
&& cd build \
162+
&& cmake -DBUILD_SHARED_LIBS=ON .. \
163+
&& make -j 4 \
164+
&& make install \
165+
&& rm -fr /tmp/*
166+
167+
# set pybind
168+
RUN cd /tmp; git clone https://github.com/pybind/pybind11.git \
169+
&& cd pybind11 \
170+
&& git checkout v2.5.0 \
171+
&& mkdir build \
172+
&& cd build \
173+
&& cmake -DPYBIND11_TEST=OFF .. \
174+
&& make \
175+
&& make install \
176+
&& rm -fr /tmp/* \
177+
&& chmod 777 /usr/lib/python3/dist-packages
178+
179+
# set xir
180+
RUN cd /tmp \
181+
&& wget -O libunilog.deb https://www.xilinx.com/bin/public/openDownload?filename=libunilog_1.4.1-r82_amd64.deb \
182+
&& wget -O libtarget-factory.deb https://www.xilinx.com/bin/public/openDownload?filename=libtarget-factory_1.4.1-r85_amd64.deb \
183+
&& wget -O libxir.deb https://www.xilinx.com/bin/public/openDownload?filename=libxir_1.4.1-r91_amd64.deb \
184+
&& wget -O libvart.deb https://www.xilinx.com/bin/public/openDownload?filename=libvart_1.4.1-r130_amd64.deb \
185+
&& wget -O libvitis_ai_library.deb https://www.xilinx.com/bin/public/openDownload?filename=libvitis_ai_library_1.4.1-r114_amd64.deb \
186+
&& wget -O librt-engine.deb https://www.xilinx.com/bin/public/openDownload?filename=librt-engine_1.4.1-r195_amd64.deb \
187+
&& wget -O aks.deb https://www.xilinx.com/bin/public/openDownload?filename=aks_1.4.1-r78_amd64.deb \
188+
&& apt-get install -y --no-install-recommends /tmp/*.deb \
189+
&& rm -rf /tmp/* \
190+
&& ldconfig
191+
192+
# install mqbench requirement
193+
RUN pip install urllib3 onnx
194+
195+
# set xir path
196+
ENV PYTHONPATH=/usr/lib/python3/dist-packages/:$PYTHONPATH
197+
198+
# install mqbench
199+
RUN cd /root/ \
200+
&& git clone https://github.com/ModelTC/MQBench.git \
201+
&& cd MQBench \
202+
&& python setup.py develop
203+

docker/prepare.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#! /bin/bash
2+
3+
4+
# install docker
5+
curl https://get.docker.com | sh \
6+
&& sudo systemctl --now enable docker
7+
8+
# add nvidia docker repo
9+
distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \
10+
&& curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - \
11+
&& curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
12+
13+
14+
sudo apt-get update
15+
sudo apt-get install -y nvidia-docker2
16+
sudo systemctl restart docker
17+
18+
docker run --rm --gpus all nvidia/cuda:10.0-cudnn7-devel-ubuntu18.04 nvidia-smi

docs/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Project Doc Rebuild
2+
3+
## Attention
4+
5+
此commit中相较前一个版本需要重新安排的文档在source/resource文件夹里,请重新编辑并关联。
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
API Reference
2+
==============
3+
4+
.. toctree::
5+
:maxdepth: 4
6+
7+
mqbench
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
mqbench.fake\_quantize package
2+
==============================
3+
4+
Submodules
5+
----------
6+
7+
mqbench.fake\_quantize.dorefa
8+
------------------------------------
9+
10+
.. automodule:: mqbench.fake_quantize.dorefa
11+
:members:
12+
:undoc-members:
13+
:show-inheritance:
14+
15+
mqbench.fake\_quantize.dsq
16+
---------------------------------
17+
18+
.. automodule:: mqbench.fake_quantize.dsq
19+
:members:
20+
:undoc-members:
21+
:show-inheritance:
22+
23+
mqbench.fake\_quantize.fixed
24+
-----------------------------------
25+
26+
.. automodule:: mqbench.fake_quantize.fixed
27+
:members:
28+
:undoc-members:
29+
:show-inheritance:
30+
31+
mqbench.fake\_quantize.lsq
32+
---------------------------------
33+
34+
.. automodule:: mqbench.fake_quantize.lsq
35+
:members:
36+
:undoc-members:
37+
:show-inheritance:
38+
39+
mqbench.fake\_quantize.nnie
40+
----------------------------------
41+
42+
.. automodule:: mqbench.fake_quantize.nnie
43+
:members:
44+
:undoc-members:
45+
:show-inheritance:
46+
47+
mqbench.fake\_quantize.pact
48+
----------------------------------
49+
50+
.. automodule:: mqbench.fake_quantize.pact
51+
:members:
52+
:undoc-members:
53+
:show-inheritance:
54+
55+
mqbench.fake\_quantize.quantize\_base
56+
--------------------------------------------
57+
58+
.. automodule:: mqbench.fake_quantize.quantize_base
59+
:members:
60+
:undoc-members:
61+
:show-inheritance:
62+
63+
Module contents
64+
---------------
65+
66+
.. automodule:: mqbench.fake_quantize
67+
:members:
68+
:undoc-members:
69+
:show-inheritance:
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
mqbench.nn.intrinsic.modules package
2+
====================================
3+
4+
Submodules
5+
----------
6+
7+
mqbench.nn.intrinsic.modules.fused
8+
-----------------------------------------
9+
10+
.. automodule:: mqbench.nn.intrinsic.modules.fused
11+
:members:
12+
:undoc-members:
13+
:show-inheritance:
14+
15+
Module contents
16+
---------------
17+
18+
.. automodule:: mqbench.nn.intrinsic.modules
19+
:members:
20+
:undoc-members:
21+
:show-inheritance:
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
mqbench.nn.intrinsic.qat.modules package
2+
========================================
3+
4+
Submodules
5+
----------
6+
7+
mqbench.nn.intrinsic.qat.modules.linear\_fused
8+
-----------------------------------------------------
9+
10+
.. automodule:: mqbench.nn.intrinsic.qat.modules.linear_fused
11+
:members:
12+
:undoc-members:
13+
:show-inheritance:
14+
15+
Module contents
16+
---------------
17+
18+
.. automodule:: mqbench.nn.intrinsic.qat.modules
19+
:members:
20+
:undoc-members:
21+
:show-inheritance:
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
mqbench.nn.intrinsic.qat package
2+
================================
3+
4+
Subpackages
5+
-----------
6+
7+
.. toctree::
8+
:maxdepth: 4
9+
10+
mqbench.nn.intrinsic.qat.modules
11+
12+
Module contents
13+
---------------
14+
15+
.. automodule:: mqbench.nn.intrinsic.qat
16+
:members:
17+
:undoc-members:
18+
:show-inheritance:
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
mqbench.nn.intrinsic package
2+
============================
3+
4+
Subpackages
5+
-----------
6+
7+
.. toctree::
8+
:maxdepth: 4
9+
10+
mqbench.nn.intrinsic.modules
11+
mqbench.nn.intrinsic.qat
12+
13+
Module contents
14+
---------------
15+
16+
.. automodule:: mqbench.nn.intrinsic
17+
:members:
18+
:undoc-members:
19+
:show-inheritance:

0 commit comments

Comments
 (0)