UCF-SST-Lab / AICity-2024-Track2-CVPRW

This is open source code for AI City Challenge Track 2 Traffic Safety Description and Analysis.
MIT License
6 stars 1 forks source link

NameError: name 'MSDA' is not defined #1

Closed KyonP closed 1 month ago

KyonP commented 1 month ago

Hello, I tried running your repo, but I encountered the following error.


  0%|                                                                                                             | 0/404 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "train.py", line 372, in <module>
    train(opt)
  File "train.py", line 224, in train
    output, loss = model(dt, criterion, opt.transformer_input_type)
  File "/root/anaconda3/envs/PDVC/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/data_mnt/AICity-2024-Track2-CVPRW/pdvc/pdvc.py", line 139, in forward
    lvl_pos_embed_flatten, mask_flatten)
  File "/home/data_mnt/AICity-2024-Track2-CVPRW/pdvc/deformable_transformer.py", line 123, in forward_encoder
    mask_flatten)
  File "/root/anaconda3/envs/PDVC/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/data_mnt/AICity-2024-Track2-CVPRW/pdvc/deformable_transformer.py", line 214, in forward
    output = layer(output, pos, reference_points, temporal_shapes, level_start_index, padding_mask)
  File "/root/anaconda3/envs/PDVC/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/data_mnt/AICity-2024-Track2-CVPRW/pdvc/deformable_transformer.py", line 182, in forward
    padding_mask)
  File "/root/anaconda3/envs/PDVC/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/data_mnt/AICity-2024-Track2-CVPRW/pdvc/ops/modules/ms_deform_attn.py", line 122, in forward
    self.im2col_step)
  File "/home/data_mnt/AICity-2024-Track2-CVPRW/pdvc/ops/functions/ms_deform_attn_func.py", line 28, in forward
    output = MSDA.ms_deform_attn_forward(
NameError: name 'MSDA' is not defined

I believe I have installed all the dependencies, but I'm not sure how to resolve this issue. Do I need to install the Deformable DETR repo?

KyonP commented 1 month ago

Just in case it's needed, I'm also attaching the result of building pdvc/ops. It seems to have built successfully, but I'm encountering an MSDA error.


running build
running build_py
copying modules/ms_deform_attn_for_caption.py -> build/lib.linux-x86_64-cpython-37/modules
copying modules/__init__.py -> build/lib.linux-x86_64-cpython-37/modules
copying modules/ms_deform_attn.py -> build/lib.linux-x86_64-cpython-37/modules
copying functions/__init__.py -> build/lib.linux-x86_64-cpython-37/functions
copying functions/ms_deform_attn_func.py -> build/lib.linux-x86_64-cpython-37/functions
running build_ext
/root/anaconda3/envs/PDVC/lib/python3.7/site-packages/torch/utils/cpp_extension.py:476: UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils backend.
  warnings.warn(msg.format('we could not find ninja.'))
/root/anaconda3/envs/PDVC/lib/python3.7/site-packages/torch/utils/cpp_extension.py:387: UserWarning: The detected CUDA version (11.8) has a minor version mismatch with the version that was used to compile PyTorch (11.7). Most likely this shouldn't be a problem.
  warnings.warn(CUDA_MISMATCH_WARN.format(cuda_str_version, torch.version.cuda))
/root/anaconda3/envs/PDVC/lib/python3.7/site-packages/torch/utils/cpp_extension.py:397: UserWarning: There are no g++ version bounds defined for CUDA version 11.8
  warnings.warn(f'There are no {compiler_name} version bounds defined for CUDA version {cuda_str_version}')
running install
/root/anaconda3/envs/PDVC/lib/python3.7/site-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
!!

        ********************************************************************************
        Please avoid running ``setup.py`` directly.
        Instead, use pypa/build, pypa/installer or other
        standards-based tools.

        See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
        ********************************************************************************

!!
  self.initialize_options()
/root/anaconda3/envs/PDVC/lib/python3.7/site-packages/setuptools/_distutils/cmd.py:66: EasyInstallDeprecationWarning: easy_install command is deprecated.
!!

        ********************************************************************************
        Please avoid running ``setup.py`` and ``easy_install``.
        Instead, use pypa/build, pypa/installer or other
        standards-based tools.

        See https://github.com/pypa/setuptools/issues/917 for details.
        ********************************************************************************

!!
  self.initialize_options()
running bdist_egg
running egg_info
writing MultiScaleDeformableAttention.egg-info/PKG-INFO
writing dependency_links to MultiScaleDeformableAttention.egg-info/dependency_links.txt
writing top-level names to MultiScaleDeformableAttention.egg-info/top_level.txt
reading manifest file 'MultiScaleDeformableAttention.egg-info/SOURCES.txt'
writing manifest file 'MultiScaleDeformableAttention.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/modules
copying build/lib.linux-x86_64-cpython-37/modules/ms_deform_attn_for_caption.py -> build/bdist.linux-x86_64/egg/modules
copying build/lib.linux-x86_64-cpython-37/modules/__init__.py -> build/bdist.linux-x86_64/egg/modules
copying build/lib.linux-x86_64-cpython-37/modules/ms_deform_attn.py -> build/bdist.linux-x86_64/egg/modules
copying build/lib.linux-x86_64-cpython-37/MultiScaleDeformableAttention.cpython-37m-x86_64-linux-gnu.so -> build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/functions
copying build/lib.linux-x86_64-cpython-37/functions/__init__.py -> build/bdist.linux-x86_64/egg/functions
copying build/lib.linux-x86_64-cpython-37/functions/ms_deform_attn_func.py -> build/bdist.linux-x86_64/egg/functions
byte-compiling build/bdist.linux-x86_64/egg/modules/ms_deform_attn_for_caption.py to ms_deform_attn_for_caption.cpython-37.pyc
byte-compiling build/bdist.linux-x86_64/egg/modules/__init__.py to __init__.cpython-37.pyc
byte-compiling build/bdist.linux-x86_64/egg/modules/ms_deform_attn.py to ms_deform_attn.cpython-37.pyc
byte-compiling build/bdist.linux-x86_64/egg/functions/__init__.py to __init__.cpython-37.pyc
byte-compiling build/bdist.linux-x86_64/egg/functions/ms_deform_attn_func.py to ms_deform_attn_func.cpython-37.pyc
creating stub loader for MultiScaleDeformableAttention.cpython-37m-x86_64-linux-gnu.so
byte-compiling build/bdist.linux-x86_64/egg/MultiScaleDeformableAttention.py to MultiScaleDeformableAttention.cpython-37.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying MultiScaleDeformableAttention.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying MultiScaleDeformableAttention.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying MultiScaleDeformableAttention.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying MultiScaleDeformableAttention.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
writing build/bdist.linux-x86_64/egg/EGG-INFO/native_libs.txt
zip_safe flag not set; analyzing archive contents...
__pycache__.MultiScaleDeformableAttention.cpython-37: module references __file__
creating 'dist/MultiScaleDeformableAttention-1.0-py3.7-linux-x86_64.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing MultiScaleDeformableAttention-1.0-py3.7-linux-x86_64.egg
removing '/root/anaconda3/envs/PDVC/lib/python3.7/site-packages/MultiScaleDeformableAttention-1.0-py3.7-linux-x86_64.egg' (and everything under it)
creating /root/anaconda3/envs/PDVC/lib/python3.7/site-packages/MultiScaleDeformableAttention-1.0-py3.7-linux-x86_64.egg
Extracting MultiScaleDeformableAttention-1.0-py3.7-linux-x86_64.egg to /root/anaconda3/envs/PDVC/lib/python3.7/site-packages
Adding MultiScaleDeformableAttention 1.0 to easy-install.pth file

Installed /root/anaconda3/envs/PDVC/lib/python3.7/site-packages/MultiScaleDeformableAttention-1.0-py3.7-linux-x86_64.egg
Processing dependencies for MultiScaleDeformableAttention==1.0
Finished processing dependencies for MultiScaleDeformableAttention==1.0
KyonP commented 1 month ago

don't know how, but I resolved this issue. maybe re-setting a docker container from scratch might help. :question: