Skip to content

Commit 37f9a15

Browse files
daisycxdingshaohua960303
authored andcommitted
fix init
1 parent e225dab commit 37f9a15

4 files changed

Lines changed: 22 additions & 6 deletions

File tree

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ python3 -m pip install git+https://github.com/MegEngine/mgeconvert.git@v0.4.2 --
8585
--install-option="--targets=tflite --tfversion=r2.4"
8686
```
8787

88+
`tflite`转换器依赖的 `libflatbuffers.so`位于 `$HOME/.local/lib`下,使用前需要执行:
89+
90+
```bash
91+
export LD_LIBRARY_PATH=$HOME/.local/lib:$LD_LIBRARY_PATH
92+
```
93+
8894
### 源代码安装
8995

9096
安装选项说明同上,以 caffe 为例,下面的命令将安装0.4.2版本的caffe转换器:
@@ -231,6 +237,17 @@ error removing /home/user/.local/lib/python3.6/site-packages/mgeconvert-0.5.0-py
231237
sudo pip3 uninstall mgeconvert
232238
```
233239

240+
2. 使用`tflite`转换器时`fbconverter.so`出现 `undefined symbol`错误:
241+
242+
```
243+
ImportError: /home//lib/python3.6/site-packages/mgeconvert/backend/ir_to_tflite/pyflexbuffers/fbconverter.so: undefined symbol: _ZN11flatbuffers13ClassicLocale9instance_E
244+
```
245+
这是链接的`libflatbuffers.so`版本和依赖版本不一致导致的问题,执行以下命令使用`mgeconvert`编译的`libflatbuffers.so`
246+
247+
```bash
248+
export LD_LIBRARY_PATH=$HOME/.local/lib:$LD_LIBRARY_PATH
249+
```
250+
234251
## 算子支持列表
235252

236253
| tracemodule:rocket:<br/>mgo:fire: | TFLite | Caffe | ONNX |

mgeconvert/backend/ir_to_caffe/init.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash -e
22

3-
python3 -m pip install --no-binary=protobuf protobuf>=3.11.1 --user
3+
python3 -m pip install --no-binary=protobuf "protobuf>=3.11.1" --user
44

55
hash wget || (echo "please install wget package" && exit -1)
66
hash protoc || (echo "please install protobuf-compiler package" && exit -1)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash -e
22

3-
python3 -m pip install onnx>=1.7.0 --user
3+
python3 -m pip install "onnx>=1.7.0" --user
44
python3 -m pip install onnxoptimizer --user
55
python3 -m pip install protobuf --user

mgeconvert/backend/ir_to_tflite/init.sh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,12 @@ fi
1717

1818
TMP_DIR="/tmp/mgeconvert/flatbuffers"
1919

20-
if [[ "$FLATC_VERSION" != "flatc version 1.12.0" || "$FLAT_BUFFER_VERSION" != "Version: 1.12" ]]; then
20+
if [[ ! -L "$HOME/.local/lib/libflatbuffers.so" || "$FLATC_VERSION" != "flatc version 1.12.0" || "$FLAT_BUFFER_VERSION" != "Version: 1.12" ]]; then
2121
rm -rf $TMP_DIR
2222
git clone https://github.com/google/flatbuffers.git -b v1.12.0 $TMP_DIR
2323
fi
2424

25-
if [[ "$FLATC_VERSION" != "flatc version 1.12.0" ]]; then
26-
python3 -m pip uninstall flatbuffers -y
25+
if [[ ! -L "$HOME/.local/lib/libflatbuffers.so" || "$FLATC_VERSION" != "flatc version 1.12.0" ]]; then
2726
rm -rf $HOME/.local/bin/flatc
2827
rm -rf $HOME/.local/lib/libflatbuffers*
2928
# build flatbuffers
@@ -69,4 +68,4 @@ PYTHON_STDLIB=$(python3 -c "import sysconfig; print(sysconfig.get_paths()['stdli
6968

7069
g++ fbconverter.cc --std=c++14 -fPIC --shared -I$HOME/.local/include -I${PYBIND11_HEADER} -I${PYTHON_INCLUDE} -L${PYTHON_STDLIB} -L$HOME/.local/lib -lflatbuffers -o fbconverter.so
7170

72-
rm -r /tmp/mgeconvert
71+
rm -rf /tmp/mgeconvert

0 commit comments

Comments
 (0)