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

Run "minigpt4_video_inference" fail, A4000-16G VRam can't run "meta-llama/Llama-2-7b-chat-hf" #44

Open
slbs2000 opened this issue Jan 2, 2025 · 0 comments

Comments

@slbs2000
Copy link

slbs2000 commented Jan 2, 2025

When I run script:
python minigpt4_video_inference.py --ckpt ./checkpoints/video_llama_checkpoint_last.pth --cfg-path ./test_configs/llama2_test_config.yaml --video_path ./demo.mp4 --question "What's this video talking about?"

Print:
{'default': 'configs/datasets/video_chatgpt/default.yaml'}
{'default': 'path to the config file'}
seed 42
Initialization Model

model arch mini_gpt4_llama_v2
model cls <class 'minigpt4.models.mini_gpt4_llama_v2.MiniGPT4_Video'>
dataset name video_chatgpt
Error setting attribute device with value cuda
Llama model
token pooling True
vit precision fp16
Position interpolate from 16x16 to 13x13
freeze the vision encoder
Loading VIT Done
Loading LLAMA
self.low_resource True
Loading checkpoint shards: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:11<00:00, 3.80s/it]trainable params: 33554432 || all params: 6771970048 || trainable%: 0.49548996469513035
Loading LLAMA Done
Load Minigpt-4-LLM Checkpoint: ./checkpoints/video_llama_checkpoint_last.pth
{'name': 'blip2_image_train', 'image_size': 192}
Initialization Finished

Then, I encountered an error :
torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 20.00 MiB. GPU 0 has a total capacity of 15.72 GiB of which 5.81 MiB is free. Including non-PyTorch memory, this process has 15.59 GiB memory in use. Of the allocated memory 15.37 GiB is allocated by PyTorch, and 45.52 MiB is reserved by PyTorch but unallocated. If reserved but unallocated memory is large try setting PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True to avoid fragmentation. See documentation for Memory Management (https://pytorch.org/docs/stable/notes/cuda.html#environment-variables)

GPU is RTX-A4000 VRAM-16G, CUDA11.8, pytorch2.2.2+cu118 , python3.9

hope to get help, Thanks!

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

1 participant