UniVAD) PS D:\UniVAD\UniVAD-main> python segment_components.py
G:\Anaconda\envs\UniVAD\lib\site-packages\timm\models\layers\__init__.py:48: FutureWarning: Importing from timm.models.layers is deprecated, please import via timm.layers
warnings.warn(f"Importing from {__name__} is deprecated, please import via timm.layers", FutureWarning)
D:\UniVAD\UniVAD-main\models\GroundingDINO\groundingdino\models\GroundingDINO\ms_deform_attn.py:31: UserWarning: Failed to load custom C++ ops. Running on CPU mode Only!
warnings.warn("Failed to load custom C++ ops. Running on CPU mode Only!")
G:\Anaconda\envs\UniVAD\lib\site-packages\torch\functional.py:513: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at C:\cb\pytorch_1000000000000\work\aten\src\ATen\native\TensorShape.cpp:3610.)
return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined]
final text_encoder_type: bert-base-uncased
D:\UniVAD\UniVAD-main\models\grounded_sam.py:48: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is
possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a fu
ture release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loade
d via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
checkpoint = torch.load(model_checkpoint_path, map_location="cpu")
_IncompatibleKeys(missing_keys=[], unexpected_keys=['label_enc.weight', 'bert.embeddings.position_ids'])
D:\UniVAD\UniVAD-main\models\segment_anything\build_sam_hq.py:107: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module
implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more
details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be a
llowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
state_dict = torch.load(f, map_location=device)
<All keys matched successfully>
grounding...: 0%| | 0/83 [00:00<?, ?it/s]G:\Anaconda\envs\UniVAD\lib\site-packages\transformers\modeling_utils.py:1161: FutureWarning: The `device` argument is deprecated and will be removed in v5 of Transformers.
warnings.warn(
G:\Anaconda\envs\UniVAD\lib\site-packages\transformers\models\bert\modeling_bert.py:440: UserWarning: 1Torch was not compiled with flash attention. (Triggered internally at C:\cb\pytorch_1000000000000\work\aten\src\ATen\native\transformers\cuda\sdp_utils.cpp:555.)
attn_output = torch.nn.functional.scaled_dot_product_attention(
G:\Anaconda\envs\UniVAD\lib\site-packages\torch\_dynamo\eval_frame.py:600: UserWarning: torch.utils.checkpoint: the use_reentrant parameter should be passed explicitly. In version 2.4 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.
return fn(*args, **kwargs)
G:\Anaconda\envs\UniVAD\lib\site-packages\torch\utils\checkpoint.py:92: UserWarning: None of the inputs have requires_grad=True. Gradients will be None
warnings.warn(
grounding...: 0%| | 0/83 [00:00<?, ?it/s]
Traceback (most recent call last):
File "segment_components.py", line 37, in <module>
grounding_segmentation(
File "D:\UniVAD\UniVAD-main\models\component_segmentaion.py", line 271, in grounding_segmentation
boxes_filt, pred_phrases = get_grounding_output(
File "D:\UniVAD\UniVAD-main\models\grounded_sam.py", line 63, in get_grounding_output
outputs = model(image[None], captions=[caption])
File "G:\Anaconda\envs\UniVAD\lib\site-packages\torch\nn\modules\module.py", line 1553, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "G:\Anaconda\envs\UniVAD\lib\site-packages\torch\nn\modules\module.py", line 1562, in _call_impl
return forward_call(*args, **kwargs)
File "D:\UniVAD\UniVAD-main\models\GroundingDINO\groundingdino\models\GroundingDINO\groundingdino.py", line 327, in forward
hs, reference, hs_enc, ref_enc, init_box_proposal = self.transformer(
File "G:\Anaconda\envs\UniVAD\lib\site-packages\torch\nn\modules\module.py", line 1553, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "G:\Anaconda\envs\UniVAD\lib\site-packages\torch\nn\modules\module.py", line 1562, in _call_impl
return forward_call(*args, **kwargs)
File "D:\UniVAD\UniVAD-main\models\GroundingDINO\groundingdino\models\GroundingDINO\transformer.py", line 258, in forward
memory, memory_text = self.encoder(
File "G:\Anaconda\envs\UniVAD\lib\site-packages\torch\nn\modules\module.py", line 1553, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "G:\Anaconda\envs\UniVAD\lib\site-packages\torch\nn\modules\module.py", line 1562, in _call_impl
return forward_call(*args, **kwargs)
File "D:\UniVAD\UniVAD-main\models\GroundingDINO\groundingdino\models\GroundingDINO\transformer.py", line 576, in forward
output = checkpoint.checkpoint(
File "G:\Anaconda\envs\UniVAD\lib\site-packages\torch\_compile.py", line 31, in inner
return disable_fn(*args, **kwargs)
File "G:\Anaconda\envs\UniVAD\lib\site-packages\torch\_dynamo\eval_frame.py", line 600, in _fn
return fn(*args, **kwargs)
File "G:\Anaconda\envs\UniVAD\lib\site-packages\torch\utils\checkpoint.py", line 481, in checkpoint
return CheckpointFunction.apply(function, preserve, *args)
File "G:\Anaconda\envs\UniVAD\lib\site-packages\torch\autograd\function.py", line 574, in apply
return super().apply(*args, **kwargs) # type: ignore[misc]
File "G:\Anaconda\envs\UniVAD\lib\site-packages\torch\utils\checkpoint.py", line 255, in forward
outputs = run_function(*args)
File "G:\Anaconda\envs\UniVAD\lib\site-packages\torch\nn\modules\module.py", line 1553, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "G:\Anaconda\envs\UniVAD\lib\site-packages\torch\nn\modules\module.py", line 1562, in _call_impl
return forward_call(*args, **kwargs)
File "D:\UniVAD\UniVAD-main\models\GroundingDINO\groundingdino\models\GroundingDINO\transformer.py", line 785, in forward
src2 = self.self_attn(
File "G:\Anaconda\envs\UniVAD\lib\site-packages\torch\nn\modules\module.py", line 1553, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "G:\Anaconda\envs\UniVAD\lib\site-packages\torch\nn\modules\module.py", line 1562, in _call_impl
return forward_call(*args, **kwargs)
File "D:\UniVAD\UniVAD-main\models\GroundingDINO\groundingdino\models\GroundingDINO\ms_deform_attn.py", line 338, in forward
output = MultiScaleDeformableAttnFunction.apply(
File "G:\Anaconda\envs\UniVAD\lib\site-packages\torch\autograd\function.py", line 574, in apply
return super().apply(*args, **kwargs) # type: ignore[misc]
File "D:\UniVAD\UniVAD-main\models\GroundingDINO\groundingdino\models\GroundingDINO\ms_deform_attn.py", line 53, in forward
output = _C.ms_deform_attn_forward(
NameError: name '_C' is not defined 这问题该怎么解决