Skip to content

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

Open
@slbs2000

Description

@slbs2000

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions