Skip to content

Commit

Permalink
fix mmdet export for coreml backend (#2392)
Browse files Browse the repository at this point in the history
* fix mmdet export

* fix lint
  • Loading branch information
irexyc authored Aug 31, 2023
1 parent d9140ab commit 5479c87
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docs/en/01-how-to-build/macos-arm64.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ The TorchScript model is used as the IR in the conversion process of the Core ML
<td>coremltools</td>
<td>
<pre><code>
pip install coremltools==6.0b2
pip install coremltools==6.3
</code></pre>
</td>
</tr>
Expand Down
4 changes: 2 additions & 2 deletions docs/en/05-supported-backends/coreml.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ MMDeploy support convert Pytorch model to Core ML and inference.

## Installation

To convert the model in mmdet, you need to compile libtorch to support custom operators such as nms.
To convert the model in mmdet, you need to compile libtorch to support custom operators such as nms (only needed in conversion stage). For MacOS 12 users, please install Pytorch 1.8.0, for MacOS 13 users, please install Pytorch 2.0.0+.

```bash
cd ${PYTORCH_DIR}
Expand All @@ -13,7 +13,7 @@ cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DPYTHON_EXECUTABLE=`which python` \
-DCMAKE_INSTALL_PREFIX=install \
-DDISABLE_SVE=ON # low version like 1.8.0 of pytorch need this option
-DDISABLE_SVE=ON
make install
```

Expand Down
2 changes: 1 addition & 1 deletion docs/zh_cn/01-how-to-build/macos-arm64.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Core ML 模型的转化过程中使用 TorchScript 模型作为IR,为了支持
<td>coremltools</td>
<td>
<pre><code>
pip install coremltools==6.0b2
pip install coremltools==6.3
</code></pre>
</td>
</tr>
Expand Down
4 changes: 2 additions & 2 deletions docs/zh_cn/05-supported-backends/coreml.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## 安装

转换 mmdet 中的模型,需要编译 libtorch 支持 nms 等自定义算子
转换 mmdet 中的模型,需要安装 libtorch 支持 nms 等自定义算子(仅转换,推理时不需要)。MacOS 12 的用户,请安装 Pytorch 1.8.0,MacOS 13+ 的用户,请安装 Pytorch 2.0.0+。

```bash
cd ${PYTORCH_DIR}
Expand All @@ -13,7 +13,7 @@ cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DPYTHON_EXECUTABLE=`which python` \
-DCMAKE_INSTALL_PREFIX=install \
-DDISABLE_SVE=ON # 低版本比如1.8.0需要加上这个参数
-DDISABLE_SVE=ON
make install
```

Expand Down
4 changes: 2 additions & 2 deletions mmdeploy/backend/coreml/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
register_torch_op


@register_torch_op
@register_torch_op(torch_alias=['mmdeploy::coreml_nms'])
def coreml_nms(context, node):
"""bind CoreML NMS op."""
inputs = _get_inputs(context, node)
Expand Down Expand Up @@ -44,7 +44,7 @@ def stack(context, node):
context.add(res)


@register_torch_op
@register_torch_op(torch_alias=['torchvision::roi_align'])
def roi_align(context, node):
"""roi align."""
inputs = _get_inputs(context, node)
Expand Down

0 comments on commit 5479c87

Please sign in to comment.