AlibabaResearch / AlibabaResearch/AdvancedLiterateMachinery

Issue exporting VGT model to ONNX - RuntimeError: invalid unordered_map<K, T> key

オープン
#191 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
C++
スター
1.8k
フォーク
195
PR マージ指標
30日以内にマージされた PR はありません

説明

Hi all,

I'm attempting to export the VGT model to ONNX format, but I'm encountering an issue where I get the following error:

```arduino
File ...\VGT\object_detection\ditod\VGTbeit.py:795
vis_x = checkpoint.checkpoint(blk, vis_x, rel_pos_bias, training_window_size)
...
RuntimeError: invalid unordered_map key
```

I’ve set up the export for the model’s backbone using dummy data for both image and grid inputs as follows:

VGTTrainer.py
```python
def export_to_onnx(self, export_path, opset_version=17, device="cpu"):

dummy_image = torch.randn(3, 1132, 800).to(device)
dummy_input_ids = torch.randint(0, 30522, (1, 1209)).to(device)
dummy_bbox = torch.randn(1, 1209, 4).to(device)
dummy_height = torch.tensor([1132], dtype=torch.int64).to(device)
dummy_width = torch.tensor([800], dtype=torch.int64).to(device)

torch.onnx.export(
self.model.backbone,
(dummy_image, dummy_bbox, dummy_input_ids, dummy_height, dummy_width),
export_path,
opset_version=opset_version,
input_names=["image", "bbox", "input_ids", "height", "width"],
output_names=["instances"],
dynamic_axes= {
"image": { 1: "height", 2: "width"},
"bbox": {0: "num_boxes"},
"input_ids": {0: "num_input_ids"}
}
)
```

I encounter the same exception if I try exporting the entire model (self.model) with dummy data.

Any guidance on troubleshooting or resolving this export error would be greatly appreciated!

Thank you!

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。