t29mato Claude Opus 4.6 commited on
Commit
4e247c3
·
1 Parent(s): dac41e5

Import MultiScaleDeformableAttention in ops __init__ for registry

Browse files

The shim's __init__.py must import the multi_scale_deform_attn
module so that @ATTENTION .register_module() is executed at import
time, making it available in the attention registry.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Files changed (1) hide show
  1. setup_mmcv_shim.py +6 -0
setup_mmcv_shim.py CHANGED
@@ -128,6 +128,12 @@ def deform_conv2d(*args, **kwargs):
128
 
129
  def get_onnxruntime_op_path():
130
  return ""
 
 
 
 
 
 
131
  '''
132
 
133
  with open(os.path.join(ops_dir, '__init__.py'), 'w') as f:
 
128
 
129
  def get_onnxruntime_op_path():
130
  return ""
131
+
132
+ # Import multi_scale_deform_attn to trigger ATTENTION registry registration
133
+ try:
134
+ from mmcv.ops.multi_scale_deform_attn import MultiScaleDeformableAttention as _MSDA
135
+ except Exception:
136
+ pass
137
  '''
138
 
139
  with open(os.path.join(ops_dir, '__init__.py'), 'w') as f: