facebookresearch / facebookresearch/perception_models

CUDA error when feeding more frames to PLM

Open
#66 0 comments 0 reactions 0 assignees View on GitHub
PLM
Dominant language
Jupyter Notebook
Stars
2.4k
Forks
162
PR merge metrics
No merged PRs in 30d

Description

Hi,

Thank you for your amazing work. I'm trying to modify and test the PLM by feeding more frames to the model. I manually set `config.data.max_video_frames = 48` and run
```
python apps/plm/generate.py --ckpt facebook/Perception-LM-8B --media_type video --media_path /shared/nas2/yaox11/ruisen/test_data/vqo/0cf71e76-0ed9-4fb9-875f-be49528105b7_797-857.mp4 --question "Describe this video."
```
and the code ran into the following error:

```
File "/shared/nas2/yaox11/ruisen/perception_models/apps/plm/generate.py", line 577, in main
generation, loglikelihood, greedy = generator.generate(prompts)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/shared/nas2/yaox11/miniconda3/envs/plm/lib/python3.12/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/shared/nas2/yaox11/ruisen/perception_models/apps/plm/generate.py", line 428, in generate
prompt_logits = self.prefill(
^^^^^^^^^^^^^
File "/shared/nas2/yaox11/ruisen/perception_models/apps/plm/generate.py", line 337, in prefill
prefill_out = self.model.forward(
^^^^^^^^^^^^^^^^^^^
File "/shared/nas2/yaox11/ruisen/perception_models/apps/plm/transformer.py", line 175, in forward
h = super().forward(h, tok_idx=tok_idx, mask=mask, attn_impl=attn_impl)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/shared/nas2/yaox11/ruisen/perception_models/core/transformer.py", line 629, in forward
h = layer(h, freq_cis, tok_idx=tok_idx, mask=mask, attn_impl=attn_impl)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/shared/nas2/yaox11/miniconda3/envs/plm/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1736, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/shared/nas2/yaox11/miniconda3/envs/plm/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1747, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/shared/nas2/yaox11/ruisen/perception_models/core/transformer.py", line 580, in forward
self.attention_norm(x),
^^^^^^^^^^^^^^^^^^^^^^
File "/shared/nas2/yaox11/miniconda3/envs/plm/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1736, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/shared/nas2/yaox11/miniconda3/envs/plm/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1747, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/shared/nas2/yaox11/ruisen/perception_models/core/transformer.py", line 330, in forward
output = self._norm(x.float())
^^^^^^^^^^^^^^^^^^^^^
File "/shared/nas2/yaox11/ruisen/perception_models/core/transformer.py", line 326, in _norm
return x * torch.rsqrt((x * x).mean(-1, keepdim=True) + self.eps)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: CUDA error: device-side assert triggered
CUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1
Compile with `TORCH_USE_CUDA_DSA` to enable device-side assertions.
```
I suspect this to be related to the maximum sequence length allowed for PLM. I wonder is there a way to fix this?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.