xISSAx / Alpha-Co-Vision

A real-time video caption to conversation bot that captures frames generates captions and creates conversational responses using a Large Language Models base to create interactive video descriptions.
MIT License
119 stars 17 forks source link

Not able to run -mps device #4

Closed MartinsRepo closed 12 months ago

MartinsRepo commented 1 year ago

─$ python main.py Traceback (most recent call last): File "/home/martin/ExternePlatten/LinuxData/LanguageModels/Alpha-Co-Vision/main.py", line 5, in from caption_generation import generate_caption File "/home/martin/ExternePlatten/LinuxData/LanguageModels/Alpha-Co-Vision/caption_generation.py", line 6, in model = BlipForConditionalGeneration.from_pretrained("Salesforce/blip-image-captioning-base",torch_dtype=torch.float16).to("mps") File "/home/martin/.pyenv/versions/alpha-co/lib/python3.10/site-packages/transformers/modeling_utils.py", line 1878, in to return super().to(*args, **kwargs) File "/home/martin/.pyenv/versions/alpha-co/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1164, in to return self._apply(convert) File "/home/martin/.pyenv/versions/alpha-co/lib/python3.10/site-packages/torch/nn/modules/module.py", line 814, in _apply module._apply(fn) File "/home/martin/.pyenv/versions/alpha-co/lib/python3.10/site-packages/torch/nn/modules/module.py", line 814, in _apply module._apply(fn) File "/home/martin/.pyenv/versions/alpha-co/lib/python3.10/site-packages/torch/nn/modules/module.py", line 814, in _apply module._apply(fn) File "/home/martin/.pyenv/versions/alpha-co/lib/python3.10/site-packages/torch/nn/modules/module.py", line 837, in _apply param_applied = fn(param) File "/home/martin/.pyenv/versions/alpha-co/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1162, in convert return t.to(device, dtype if t.is_floating_point() or t.is_complex() else None, non_blocking) RuntimeError: PyTorch is not linked with support for mps devices

xISSAx commented 12 months ago

Hey Martin,

sorry for a delayed reply!

"RuntimeError: PyTorch is not linked with support for mps devices" not supported could mean 2 things: either you have a device that is not supported on mps (apple) or pytorch is not correctly installed for mps.

If you are on Mac and need help with getting started with using mps follow this guide: https://vkumethi.medium.com/how-to-install-pytorch-on-apple-silicon-mac-m1-m2-easiest-guide-d31a7c683367

and if you are not on Mac, then you will need to change the MPS devices in the lines to CUDA or CPU <3

Hope it helps!