huggingface / optimum

🚀 Accelerate training and inference of 🤗 Transformers and 🤗 Diffusers with easy to use hardware optimization tools
https://huggingface.co/docs/optimum/main/
Apache License 2.0
2.46k stars 442 forks source link

Adding Support for DETA Model #2018

Open TheMattBin opened 1 week ago

TheMattBin commented 1 week ago

Feature request

Adding support for DETA model

Motivation

Currently quite few vision models are supported in optimum, but no DETA, wanna test and compare with others in practical usage.

Your contribution

I can try to submit a PR, just need a bit guide here for vision model for onnx.

IlyasMoutawwakil commented 1 week ago

Hi ! would love to review a PR 🤗, if you need guidance there's this very cool PR by @xenova that adds support for many vision models https://github.com/huggingface/optimum/pull/2001.

TheMattBin commented 4 days ago

Thanks for the reply! I tried my script for testing before submit the PR. However, I encountered an issue like below:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1543, in _slow_forward
    result = self.forward(*input, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/transformers/models/deprecated/deta/modeling_deta.py", line 1750, in forward
    pre_nms_inds.append(torch.topk(prop_logits_b.sigmoid() * lvl_mask, pre_nms_topk)[1])
RuntimeError: selected index k out of range

I'm not sure if this relates to DETA model with transformers. Do you have any ideas on this? Thanks!