Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'OpenCLIPVisionTower' object has no attribute 'device' #96

Open
l1019008146 opened this issue Apr 27, 2024 · 2 comments

Comments

@l1019008146
Copy link

image
how to solve it?

@jiezhangGt
Copy link

I also encountered this problem!

2024-04-29 15:22:27 | ERROR | stderr | Exception in thread Thread-4 (generate):
2024-04-29 15:22:27 | ERROR | stderr | Traceback (most recent call last):
2024-04-29 15:22:27 | ERROR | stderr |   File "/mnt/pfs/HOME/miniconda3/envs/llava/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
2024-04-29 15:22:27 | ERROR | stderr |     self.run()
2024-04-29 15:22:27 | ERROR | stderr |   File "/mnt/pfs/HOME/miniconda3/envs/llava/lib/python3.10/threading.py", line 953, in run
2024-04-29 15:22:27 | ERROR | stderr |     self._target(*self._args, **self._kwargs)
2024-04-29 15:22:27 | ERROR | stderr |   File "/mnt/pfs/HOME/miniconda3/envs/llava/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
2024-04-29 15:22:27 | ERROR | stderr |     return func(*args, **kwargs)
2024-04-29 15:22:27 | ERROR | stderr |   File "/mnt/pfs/2024/Q2/workspace/MGM/mgm/model/language_model/mgm_llama.py", line 171, in generate
2024-04-29 15:22:27 | ERROR | stderr |     ) = self.prepare_inputs_labels_for_multimodal(
2024-04-29 15:22:27 | ERROR | stderr |   File "/mnt/pfs/2024/Q2/workspace/MGM/mgm/model/mgm_arch.py", line 333, in prepare_inputs_labels_for_multimodal
2024-04-29 15:22:27 | ERROR | stderr |     image_features = self.encode_images(images, images_aux)
2024-04-29 15:22:27 | ERROR | stderr |   File "/mnt/pfs/2024/Q2/workspace/MGM/mgm/model/mgm_arch.py", line 255, in encode_images
2024-04-29 15:22:27 | ERROR | stderr |     image_aux_features_raw = self.get_model().get_vision_tower_aux()(images_aux).to(
2024-04-29 15:22:27 | ERROR | stderr |   File "/mnt/pfs/HOME/miniconda3/envs/llava/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
2024-04-29 15:22:27 | ERROR | stderr |     return self._call_impl(*args, **kwargs)
2024-04-29 15:22:27 | ERROR | stderr |   File "/mnt/pfs/HOME/miniconda3/envs/llava/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
2024-04-29 15:22:27 | ERROR | stderr |     return forward_call(*args, **kwargs)
2024-04-29 15:22:27 | ERROR | stderr |   File "/mnt/pfs/HOME/miniconda3/envs/llava/lib/python3.10/site-packages/accelerate/hooks.py", line 165, in new_forward
2024-04-29 15:22:27 | ERROR | stderr |     output = old_forward(*args, **kwargs)
2024-04-29 15:22:27 | ERROR | stderr |   File "/mnt/pfs/2024/Q2/workspace/MGM/mgm/model/multimodal_encoder/openclip_encoder.py", line 62, in forward
2024-04-29 15:22:27 | ERROR | stderr |     image_features = self.backbone(images.to(device=self.device, dtype=self.dtype))
2024-04-29 15:22:27 | ERROR | stderr |   File "/mnt/pfs/HOME/miniconda3/envs/llava/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1695, in __getattr__
2024-04-29 15:22:27 | ERROR | stderr |     raise AttributeError(f"'{type(self).__name__}' object has no attribute '{name}'")
2024-04-29 15:22:27 | ERROR | stderr | AttributeError: 'OpenCLIPVisionTower' object has no attribute 'device'

@adrielkuek
Copy link

#93 indicates model naming error. Need to add "mgm" into the name for lookup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants