DAMO-NLP-SG / DAMO-NLP-SG/VideoLLaMA2

Quick question on the need for `KeywordsStoppingCriteria`

Open
#130 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.3k
Forks
90
PR merge metrics
No merged PRs in 30d

Description

Hello Team,

First off, thanks for your work! It is truly a great project!

Quick question on the `KeywordsStoppingCriteria` [implementation](https://github.com/DAMO-NLP-SG/VideoLLaMA2/blob/main/videollama2/mm_utils.py#L326-L357). I see that it is a custom stopping criteria appended to other forms like EOSTokenCriteria,MaxLengthCriteria etc..

As far as I understood, The `EOSTokenCriteria` used [here](https://github.com/huggingface/transformers/blob/v4.40.0/src/transformers/generation/utils.py#L902) looks if the predicted token is an EOS token which is `151645` which I believe is the same as the `KeywordsStoppingCriteria` functionality where the `['<|im_end|>']` is tokenized as `151645`. I feel they do the same thing. Return `True` if the predicted token is `151645`.

I tried passing `None` to `stopping_criteria` [here](https://github.com/DAMO-NLP-SG/VideoLLaMA2/blob/main/videollama2/__init__.py#L108) and it did not change the behavior. Is there a reason we need both?

Contributor guide

No contributing guide indexed for this repository

Research direction

Compare the KeywordsStoppingCriteria implementation in videollama2/mm_utils.py with the generation stopping criteria referenced in Transformers, then inspect how stopping_criteria is passed in videollama2/__init__.py. Determine whether both mechanisms are needed and document the confirmed behavior or scope any cleanup. Done means the redundancy question has a clear, tested answer.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
ai, machine-learning
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.