ITADN

Crash on Execution Local demo: _C is not defined in ms_deform_attn.py

#110OpenHyper-lgy 创建于 2025-07-18
H
Hyper-lgycommented
UserWarning: Failed to load custom C++ ops. Running on CPU mode Only! UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at C:\actions-runner\_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\TensorShape.cpp:3596.) final text_encoder_type: bert-base-uncased UserWarning: The given NumPy array is not writable, and PyTorch does not support non-writable tensors. This means writing to this tensor will result in undefined behavior. You may want to copy the array to protect its data or make it writable before converting it to a tensor. This type of warning will be suppressed for the rest of this program. (Triggered internally at C:\actions-runner\_work\pytorch\pytorch\builder\windows\pytorch\torch\csrc\utils\tensor_numpy.cpp:212.) UserWarning: torch.utils.checkpoint: the use_reentrant parameter should be passed explicitly. In version 2.5 we will raise an exception if use_reentrant is not passed. use_reentrant=False is recommended, but if you need to preserve the current default behavior, you can pass use_reentrant=True. Refer to docs for more details on the differences between the two variants. UserWarning: None of the inputs have requires_grad=True. Gradients will be None Traceback (most recent call last): File "C:\Users\lgylx\WorkSpace\sam2Demo\Grounded-SAM-2\grounded_sam2_local_demo.py", line 58, in <module> boxes, confidences, labels = predict( File "C:\Users\lgylx\WorkSpace\sam2Demo\Grounded-SAM-2\grounding_dino\groundingdino\util\inference.py", line 68, in predict outputs = model(image[None], captions=[caption]) File "C:\Users\lgylx\Miniconda3\envs\sam2-env\lib\site-packages\torch\nn\modules\module.py", line 1736, in _wrapped_call_impl return self._call_impl(*args, **kwargs) File "C:\Users\lgylx\Miniconda3\envs\sam2-env\lib\site-packages\torch\nn\modules\module.py", line 1747, in _call_impl return forward_call(*args, **kwargs) File "C:\Users\lgylx\WorkSpace\sam2Demo\Grounded-SAM-2\grounding_dino\groundingdino\models\GroundingDINO\groundingdino.py", line 327, in forward hs, reference, hs_enc, ref_enc, init_box_proposal = self.transformer( File "C:\Users\lgylx\Miniconda3\envs\sam2-env\lib\site-packages\torch\nn\modules\module.py", line 1736, in _wrapped_call_impl return self._call_impl(*args, **kwargs) File "C:\Users\lgylx\Miniconda3\envs\sam2-env\lib\site-packages\torch\nn\modules\module.py", line 1747, in _call_impl return forward_call(*args, **kwargs) File "C:\Users\lgylx\WorkSpace\sam2Demo\Grounded-SAM-2\grounding_dino\groundingdino\models\GroundingDINO\transformer.py", line 258, in forward memory, memory_text = self.encoder( File "C:\Users\lgylx\Miniconda3\envs\sam2-env\lib\site-packages\torch\nn\modules\module.py", line 1736, in _wrapped_call_impl return self._call_impl(*args, **kwargs) File "C:\Users\lgylx\Miniconda3\envs\sam2-env\lib\site-packages\torch\nn\modules\module.py", line 1747, in _call_impl return forward_call(*args, **kwargs) File "C:\Users\lgylx\WorkSpace\sam2Demo\Grounded-SAM-2\grounding_dino\groundingdino\models\GroundingDINO\transformer.py", line 576, in forward output = checkpoint.checkpoint( File "C:\Users\lgylx\Miniconda3\envs\sam2-env\lib\site-packages\torch\_compile.py", line 32, in inner return disable_fn(*args, **kwargs) File "C:\Users\lgylx\Miniconda3\envs\sam2-env\lib\site-packages\torch\_dynamo\eval_frame.py", line 632, in _fn return fn(*args, **kwargs) File "C:\Users\lgylx\Miniconda3\envs\sam2-env\lib\site-packages\torch\utils\checkpoint.py", line 489, in checkpoint return CheckpointFunction.apply(function, preserve, *args) File "C:\Users\lgylx\Miniconda3\envs\sam2-env\lib\site-packages\torch\autograd\function.py", line 575, in apply return super().apply(*args, **kwargs) # type: ignore[misc] File "C:\Users\lgylx\Miniconda3\envs\sam2-env\lib\site-packages\torch\utils\checkpoint.py", line 264, in forward outputs = run_function(*args) File "C:\Users\lgylx\Miniconda3\envs\sam2-env\lib\site-packages\torch\nn\modules\module.py", line 1736, in _wrapped_call_impl return self._call_impl(*args, **kwargs) File "C:\Users\lgylx\Miniconda3\envs\sam2-env\lib\site-packages\torch\nn\modules\module.py", line 1747, in _call_impl return forward_call(*args, **kwargs) File "C:\Users\lgylx\WorkSpace\sam2Demo\Grounded-SAM-2\grounding_dino\groundingdino\models\GroundingDINO\transformer.py", line 785, in forward src2 = self.self_attn( File "C:\Users\lgylx\Miniconda3\envs\sam2-env\lib\site-packages\torch\nn\modules\module.py", line 1736, in _wrapped_call_impl return self._call_impl(*args, **kwargs) File "C:\Users\lgylx\Miniconda3\envs\sam2-env\lib\site-packages\torch\nn\modules\module.py", line 1747, in _call_impl return forward_call(*args, **kwargs) File "C:\Users\lgylx\WorkSpace\sam2Demo\Grounded-SAM-2\grounding_dino\groundingdino\models\GroundingDINO\ms_deform_attn.py", line 338, in forward output = MultiScaleDeformableAttnFunction.apply( File "C:\Users\lgylx\Miniconda3\envs\sam2-env\lib\site-packages\torch\autograd\function.py", line 575, in apply return super().apply(*args, **kwargs) # type: ignore[misc] File "C:\Users\lgylx\WorkSpace\sam2Demo\Grounded-SAM-2\grounding_dino\groundingdino\models\GroundingDINO\ms_deform_attn.py", line 53, in forward output = _C.ms_deform_attn_forward( NameError: name '_C' is not defined Env: Name: torch Version: 2.5.1+cu121 --- Name: torchvision Version: 0.20.1+cu121 --- Name: torchaudio Version: 2.5.1+cu121
2 条评论