Git Product home page Git Product logo

Comments (8)

Kenneth-X avatar Kenneth-X commented on July 19, 2024

same question, also want to export to torchscript, did you made it ?

from mask2former.

luoolu avatar luoolu commented on July 19, 2024

same question,anyone can share successful export case

from mask2former.

Osd-ysck avatar Osd-ysck commented on July 19, 2024

I tried the following method.

  1. use ms_deform_attn_core_pytorch instead of MSDeformAttnFunction.apply.

    try:
    output = MSDeformAttnFunction.apply(
    value, input_spatial_shapes, input_level_start_index, sampling_locations, attention_weights, self.im2col_step)
    except:
    # CPU
    output = ms_deform_attn_core_pytorch(value, input_spatial_shapes, sampling_locations, attention_weights)

  2. use detectron2 deploy tool.
    --format=torchscript
    --export-method=tracing
    using sample-image
    https://github.com/facebookresearch/detectron2/blob/7c2c8fb168a2093ce06a531c1208fba48d2984ec/tools/deploy/export_model.py

succeed in export but torchscript model got different results from pytorch model.
Can someone please share a successful method?

from mask2former.

mchaniotakis avatar mchaniotakis commented on July 19, 2024

Same issue here. Do you have any updates? Have you tried re-training with ms_deform_attn_core_pytorch(Must be slow) and exporting after?

from mask2former.

Robotatron avatar Robotatron commented on July 19, 2024

Any update? Would like to export the model to any format for deployment

from mask2former.

Zalways avatar Zalways commented on July 19, 2024

I have been troubled by this problem for a long time, has anyone solved it? thanks

from mask2former.

Zalways avatar Zalways commented on July 19, 2024

I tried the following method.

  1. use ms_deform_attn_core_pytorch instead of MSDeformAttnFunction.apply.
    try:
    output = MSDeformAttnFunction.apply(
    value, input_spatial_shapes, input_level_start_index, sampling_locations, attention_weights, self.im2col_step)
    except:
    # CPU
    output = ms_deform_attn_core_pytorch(value, input_spatial_shapes, sampling_locations, attention_weights)
  2. use detectron2 deploy tool.
    --format=torchscript
    --export-method=tracing
    using sample-image
    https://github.com/facebookresearch/detectron2/blob/7c2c8fb168a2093ce06a531c1208fba48d2984ec/tools/deploy/export_model.py

succeed in export but torchscript model got different results from pytorch model. Can someone please share a successful method?

have you solved this problem? i tried you method,and export the model successfully,but the exported model cann't inference on image. @Osd-ysck

from mask2former.

roboserg avatar roboserg commented on July 19, 2024

After 3 years, is there a way to export this model to ONNX or TorchScript?
M2F is supported in Huggingface now, can we simply load M2F trained with Detectron2 with Huggingface? With HF, we would be able to export to ONNX for fast inference.

from mask2former.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.