Skip to content

Commit

Permalink
Merge pull request #67 from breezedeus/pytorch
Browse files Browse the repository at this point in the history
adapt with the new version of ORT
  • Loading branch information
breezedeus committed Sep 23, 2023
2 parents 5549b02 + 1c7d79e commit 160a866
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ package:
rm -rf build
python setup.py sdist bdist_wheel

VERSION = 1.2.3.3
VERSION = 1.2.3.4
upload:
python -m twine upload dist/cnstd-$(VERSION)* --verbose

Expand Down
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,22 @@ MFD 模型检测图片中包含的数学公式,其中行内的公式检测为
pip install cnstd
```

如果需要使用 ONNX 模型(`model_backend=onnx`),请使用以下命令安装:

* CPU环境使用 ONNX 模型:
```bash
pip install cnstd[ort-cpu]
```
* GPU环境使用 ONNX 模型:
```bash
pip install cnstd[ort-gpu]
```
* 注意:如果当前环境已经安装了 `onnxruntime` 包,请先手动卸载(`pip uninstall onnxruntime`)后再运行上面的命令。

安装速度慢的话,可以指定国内的安装源,如使用豆瓣源:

```bash
pip install cnstd -i https://pypi.doubanio.com/simple
pip install cnstd -i https://mirrors.aliyun.com/pypi/simple
```

【注意】:
Expand Down
8 changes: 8 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Release Notes

# Update 2023.09.23:发布 V1.2.3.4

主要变更:
* 增加了对 `onnxruntine` (ORT) 新版的兼容:`InferenceSession` 中显式提供了 `providers` 参数。
* `setup.py` 中去除对 `onnxruntime` 的依赖,改为在 `extras_require` 中按需指定:
* `cnstd[ort-cpu]``onnxruntime`
* `cnstd[ort-gpu]`: `onnxruntime-gpu`

# Update 2023.09.21:发布 V1.2.3.3

主要变更:
Expand Down
2 changes: 1 addition & 1 deletion cnstd/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
# specific language governing permissions and limitations
# under the License.

__version__ = '1.2.3.3'
__version__ = '1.2.3.4'
2 changes: 1 addition & 1 deletion cnstd/ppocr/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def create_predictor(model_fp, mode, logger):
model_file_path = model_fp
if not os.path.exists(model_file_path):
raise ValueError("not find model file path {}".format(model_file_path))
sess = ort.InferenceSession(model_file_path)
sess = ort.InferenceSession(model_file_path, providers=['AzureExecutionProvider', 'CPUExecutionProvider'])
return sess, sess.get_inputs()[0], None, None


Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,12 @@
'matplotlib',
'seaborn',
"onnx",
"onnxruntime",
"huggingface_hub",
]

extras_require = {
"ort-cpu": ["onnxruntime"],
"ort-gpu": ["onnxruntime-gpu"],
"dev": ["pip-tools", "pytest"],
}

Expand Down

0 comments on commit 160a866

Please sign in to comment.