Giter Site home page Giter Site logo

mbzuai-oryx / video-llava Goto Github PK

View Code? Open in Web Editor NEW
206.0 14.0 12.0 19.28 MB

PG-Video-LLaVA: Pixel Grounding in Large Multimodal Video Models

Home Page: https://mbzuai-oryx.github.io/Video-LLaVA

Python 99.32% Shell 0.68%
llm lmm video video-conversation grounding transcription video-grounding

video-llava's Introduction

PG-Video-LLaVA: Pixel Grounding in Large Multimodal Video Models

Shehan Munasinghe* , Rusiru Thushara* , Muhammad Maaz , Hanoona Rasheed, Salman Khan, Mubarak Shah, Fahad Shahbaz Khan.

*Equal Contribution

Mohamed bin Zayed University of Artificial Intelligence, UAE

Website paper


๐Ÿ“ข Latest Updates

  • ๐Ÿ“ฆ 27-Dec-2023: Code, models released! ๐Ÿš€

Overview

PG-Video-LLaVA is the first video-based Large Multimodal Model (LMM) with pixel-level grounding capabilities. ๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅ

PG-Video-LLaVA Architectural Overview


๐Ÿ† Contributions

The key contributions of this work are:

  • We propose PG-Video-LLaVA, the first video-based LMM with pixel-level grounding capabilities, featuring a modular design for enhanced flexibility. Our framework uses an off-the-shelf tracker and a novel grounding module, enabling it to spatially ground objects in videos following user instructions.

  • We introduce a new benchmark specifically designed to measure prompt-based object grounding performance.

  • By incorporating audio context, PG-Video-LLaVA significantly enhances its understanding of video content, making it more comprehensive and aptly suited for scenarios where the audio signal is crucial for video understanding (e.g., dialogues and conversations, news videos, etc.).

  • We introduce improved quantitative benchmarks for video-based conversational models. Our benchmarks utilize open-source Vicuna LLM to ensure better reproducibility and transparency. We also propose benchmarks to evaluate the grounding capabilities of video-based conversational models.


PG-Video-LLaVA : Architecture

PG-Video-LLaVA Architectural Overview


Installation and CLI Demo

For installation and setting up the CLI demo, please refer to the instructions here.


Training

For training, please refer to the instructions here.


Qualitative Analysis ๐Ÿ”

Video Grounding ๐ŸŽฏ

Our framework uses an off-the-shelf tracker and a novel grounding module, enabling it to localize objects in videos following user instructions.

Video-Grounding Qualitative Results


Including Audio Modality ๐ŸŽง

By incorporating audio context, PG-Video-LLaVA significantly enhances its understanding of video content, making it more comprehensive and aptly suited for scenarios where the audio signal is crucial for video understanding (e.g., dialogues and conversations, news videos, etc.).

Qualitative Results: Audio modality


Video-ChatGPT vs PG-Video-LLaVA

PG-Video-LLaVA is based on a stronger image-LMM baseline which gives it better conversational ability compared to its predecessor.

Video-ChatGPT vs PG-Video-LLaVA


Quantitative Evaluation ๐Ÿ“Š

We evaluate PG-Video-LLaVA using video-based generative and question-answering benchmarks. We also introduce new benchmarks specifically designed to measure prompt-based object grounding performance in videos.

Video Grounding ๐ŸŽฏ

To quantitatively assess PG-Video-LLaVAโ€™s spatial grounding capability, we conducted quantitative evaluations of PG-Video-LLaVAโ€™s spatial grounding capabilities using two benchmarks that are derived from the test set of the VidSTG and HC-STVG datasets.

For detailed instructions on performing quantitative evaluation on video grounding, please refer this.

Video-Grounding Quantitative Results


Video-based Generative Performance Benchmarking ๐Ÿค–

We apply the benchmarking framework from Video-ChatGPT which measures performance on several axes critical for video-based conversational agents, including correctness of information, detail orientation, contextual understanding, temporal understanding, and consistency. In order to facilitate a reliable and reproducible evaluation, we have updated our assessment pipeline by replacing GPT-3.5 with Vicuna-13b-v1.5.

Video-based Generative Performance Benchmarking


Zero-Shot Question Answering ๐Ÿ’ฌ

Zero-shot question-answering (QA) capabilities were evaluated quantitatively using several established open-ended QA datasets: MSRVTT-QA, MSVD-QA, TGIF-QA, and ActivityNet-QA.

Zero-shot QA Quantitative Results

For detailed instructions on video-based generative performance benchmarking and zero-shot question answering benchmark, please refer this.


Acknowledgements ๐Ÿ™

  • LLaMA: a great attempt towards open and efficient LLMs!
  • Vicuna: has the amazing language capabilities!
  • LLaVA: our architecture is inspired from LLaVA.
  • Video-ChatGPT: the predecessor to PG-Video-LLaVA

Citation ๐Ÿ“œ

If you're using PG-Video-LLaVA in your research or applications, please cite using this BibTeX:

  @article{munasinghe2023PGVideoLLaVA,
        title={PG-Video-LLaVA: Pixel Grounding Large Video-Language Models}, 
        author={Shehan Munasinghe and Rusiru Thushara and Muhammad Maaz and Hanoona Abdul Rasheed and Salman Khan and Mubarak Shah and Fahad Khan},
        journal={ArXiv 2311.13435},
        year={2023}
  }

video-llava's People

Contributors

shehanmunasinghe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

video-llava's Issues

License

Please add license for this repo and model.
In deed very nice work.

Flash Attention

Hi,

Thank you for the codebase and the models! I notice that flash attention is one of the dependencies of the project. Since I'm working on AMD GPUs and currently installing flash attention with ROCm support is rather challenging, I was wondering whether I could skip installing it, as I want to use Video-Llava mostly for inference, and the instructions suggest to install flash attention only if training is required. Does this mean that if I don't install it and run inference it should run without issues? Thank you!

CLI Demo can be me made much simpler by adding more instructions in the README.md section

I'd like to suggest several enhancements that could improve the project's usability and documentation:

  1. Incorporation of a setup.py File: It would be highly beneficial to include a setup.py file in the repository. This file could automate the installation process by building the setup tools dependency, and streamlining the setup for new users.

  2. Documentation of FlashAttention in Training.md: I recommend adding a section or note about the FlashAttention mechanism within the Training.md documentation. This addition would help users understand its role and implementation within the training process.

  3. Guidance on Downloading the LLaVA Model: Providing a command or step-by-step instructions for downloading the LLaVA model using the snapshot module from Hugging Face would greatly assist users in getting started with the model. This clarity could prevent confusion and streamline the initial setup.

  4. Separate README for Grounding Functionality: Considering the complexity and importance of grounding functionality, create a separate README.md focused on this aspect could make the information more accessible and easier to digest for new users.

Exploring the model with grounding capabilities hosted on Hugging Face would be immensely helpful for gaining a deeper understanding.

@shehanmunasinghe, these suggestions are intended to enhance the project's accessibility, documentation, and user experience. I believe these improvements could make a significant difference for both new and existing users.

Time codes

This is really an excellent tool.
I want to ask that is it possible to take the time codes also with each sentence explanation? if you have any tip to export it would be a great help.

Error while loading tokenizer

Hello,

Thanks for making the code and models available. I was following the guide to set up the repo and run a CLI demo.

The command line arguments looks like this:

python video_chatgpt/chat.py --model-name weights/llava/llava-v1.5-7b --projection_path weights/projection/mm_projector_7b_1.5_336px.bin --use_asr --conv_mode pg-video-llava

The --model-name argument is path to the folder who's contents are shown here and the --projection_path argument is path to the folder containing mm_projector_7b_1.5_336px.bin file.

I'm facing an error while loading the vocab_file, the resolved vocab_file is weights/llava/llava-v1.5-7b/tokenizer.model
The error traceback is as follows:

โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Traceback (most recent call last) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ /media/vishal/2TB_storage/repos/Video-LLaVA/video_chatgpt/chat.py:362 in     โ”‚
โ”‚ <module>                                                                     โ”‚
โ”‚                                                                              โ”‚
โ”‚   359 โ”‚   โ”‚   )                                                              โ”‚
โ”‚   360 โ”‚   โ”‚   chat.interact()                                                โ”‚
โ”‚   361 โ”‚   else:                                                              โ”‚
โ”‚ โฑ 362 โ”‚   โ”‚   chat = VideoChatGPTInterface(                                  โ”‚
โ”‚   363 โ”‚   โ”‚   โ”‚   args_model_name=args.model_name,                           โ”‚
โ”‚   364 โ”‚   โ”‚   โ”‚   args_projection_path=args.projection_path,                 โ”‚
โ”‚   365 โ”‚   โ”‚   โ”‚   use_asr=args.use_asr,                                      โ”‚
โ”‚                                                                              โ”‚
โ”‚ /media/vishal/2TB_storage/repos/Video-LLaVA/video_chatgpt/chat.py:29 in      โ”‚
โ”‚ __init__                                                                     โ”‚
โ”‚                                                                              โ”‚
โ”‚    26 โ”‚   โ”‚   self.use_asr=use_asr                                           โ”‚
โ”‚    27 โ”‚   โ”‚   self.conv_mode = conv_mode                                     โ”‚
โ”‚    28 โ”‚   โ”‚                                                                  โ”‚
โ”‚ โฑ  29 โ”‚   โ”‚   model, vision_tower, tokenizer, image_processor, video_token_l โ”‚
โ”‚    30 โ”‚   โ”‚   self.tokenizer = tokenizer                                     โ”‚
โ”‚    31 โ”‚   โ”‚   self.image_processor = image_processor                         โ”‚
โ”‚    32 โ”‚   โ”‚   self.vision_tower = vision_tower                               โ”‚
โ”‚                                                                              โ”‚
โ”‚ /media/vishal/2TB_storage/repos/Video-LLaVA/video_chatgpt/eval/model_utils.p โ”‚
โ”‚ y:101 in initialize_model                                                    โ”‚
โ”‚                                                                              โ”‚
โ”‚    98 โ”‚   model_name = os.path.expanduser(model_name)                        โ”‚
โ”‚    99 โ”‚                                                                      โ”‚
โ”‚   100 โ”‚   # Load tokenizer                                                   โ”‚
โ”‚ โฑ 101 โ”‚   tokenizer = AutoTokenizer.from_pretrained(model_name)              โ”‚
โ”‚   102 โ”‚                                                                      โ”‚
โ”‚   103 โ”‚   # Load model                                                       โ”‚
โ”‚   104 โ”‚   model = VideoChatGPTLlamaForCausalLM.from_pretrained(model_name, l โ”‚
โ”‚                                                                              โ”‚
โ”‚ /home/vishal/miniconda3/envs/pg_video_llava/lib/python3.10/site-packages/tra โ”‚
โ”‚ nsformers/models/auto/tokenization_auto.py:682 in from_pretrained            โ”‚
โ”‚                                                                              โ”‚
โ”‚   679 โ”‚   โ”‚   โ”‚   โ”‚   raise ValueError(                                      โ”‚
โ”‚   680 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   f"Tokenizer class {tokenizer_class_candidate} does โ”‚
โ”‚   681 โ”‚   โ”‚   โ”‚   โ”‚   )                                                      โ”‚
โ”‚ โฑ 682 โ”‚   โ”‚   โ”‚   return tokenizer_class.from_pretrained(pretrained_model_na โ”‚
โ”‚   683 โ”‚   โ”‚                                                                  โ”‚
โ”‚   684 โ”‚   โ”‚   # Otherwise we have to be creative.                            โ”‚
โ”‚   685 โ”‚   โ”‚   # if model is an encoder decoder, the encoder tokenizer class  โ”‚
โ”‚                                                                              โ”‚
โ”‚ /home/vishal/miniconda3/envs/pg_video_llava/lib/python3.10/site-packages/tra โ”‚
โ”‚ nsformers/tokenization_utils_base.py:1805 in from_pretrained                 โ”‚
โ”‚                                                                              โ”‚
โ”‚   1802 โ”‚   โ”‚   โ”‚   else:                                                     โ”‚
โ”‚   1803 โ”‚   โ”‚   โ”‚   โ”‚   logger.info(f"loading file {file_path} from cache at  โ”‚
โ”‚   1804 โ”‚   โ”‚                                                                 โ”‚
โ”‚ โฑ 1805 โ”‚   โ”‚   return cls._from_pretrained(                                  โ”‚
โ”‚   1806 โ”‚   โ”‚   โ”‚   resolved_vocab_files,                                     โ”‚
โ”‚   1807 โ”‚   โ”‚   โ”‚   pretrained_model_name_or_path,                            โ”‚
โ”‚   1808 โ”‚   โ”‚   โ”‚   init_configuration,                                       โ”‚
โ”‚                                                                              โ”‚
โ”‚ /home/vishal/miniconda3/envs/pg_video_llava/lib/python3.10/site-packages/tra โ”‚
โ”‚ nsformers/tokenization_utils_base.py:1959 in _from_pretrained                โ”‚
โ”‚                                                                              โ”‚
โ”‚   1956 โ”‚   โ”‚                                                                 โ”‚
โ”‚   1957 โ”‚   โ”‚   # Instantiate tokenizer.                                      โ”‚
โ”‚   1958 โ”‚   โ”‚   try:                                                          โ”‚
โ”‚ โฑ 1959 โ”‚   โ”‚   โ”‚   tokenizer = cls(*init_inputs, **init_kwargs)              โ”‚
โ”‚   1960 โ”‚   โ”‚   except OSError:                                               โ”‚
โ”‚   1961 โ”‚   โ”‚   โ”‚   raise OSError(                                            โ”‚
โ”‚   1962 โ”‚   โ”‚   โ”‚   โ”‚   "Unable to load vocabulary from file. "               โ”‚
โ”‚                                                                              โ”‚
โ”‚ /home/vishal/miniconda3/envs/pg_video_llava/lib/python3.10/site-packages/tra โ”‚
โ”‚ nsformers/models/llama/tokenization_llama.py:71 in __init__                  โ”‚
โ”‚                                                                              โ”‚
โ”‚    68 โ”‚   โ”‚   self.add_eos_token = add_eos_token                             โ”‚
โ”‚    69 โ”‚   โ”‚   self.decode_with_prefix_space = decode_with_prefix_space       โ”‚
โ”‚    70 โ”‚   โ”‚   self.sp_model = spm.SentencePieceProcessor(**self.sp_model_kwa โ”‚
โ”‚ โฑ  71 โ”‚   โ”‚   self.sp_model.Load(vocab_file)                                 โ”‚
โ”‚    72 โ”‚   โ”‚   self._no_prefix_space_tokens = None                            โ”‚
โ”‚    73 โ”‚   โ”‚                                                                  โ”‚
โ”‚    74 โ”‚   โ”‚   """ Initialisation"""                                          โ”‚
โ”‚                                                                              โ”‚
โ”‚ /home/vishal/miniconda3/envs/pg_video_llava/lib/python3.10/site-packages/sen โ”‚
โ”‚ tencepiece/__init__.py:905 in Load                                           โ”‚
โ”‚                                                                              โ”‚
โ”‚    902 โ”‚   โ”‚   raise RuntimeError('model_file and model_proto must be exclus โ”‚
โ”‚    903 โ”‚     if model_proto:                                                 โ”‚
โ”‚    904 โ”‚   โ”‚   return self.LoadFromSerializedProto(model_proto)              โ”‚
โ”‚ โฑ  905 โ”‚     return self.LoadFromFile(model_file)                            โ”‚
โ”‚    906                                                                       โ”‚
โ”‚    907                                                                       โ”‚
โ”‚    908 # Register SentencePieceProcessor in _sentencepiece:                  โ”‚
โ”‚                                                                              โ”‚
โ”‚ /home/vishal/miniconda3/envs/pg_video_llava/lib/python3.10/site-packages/sen โ”‚
โ”‚ tencepiece/__init__.py:310 in LoadFromFile                                   โ”‚
โ”‚                                                                              โ”‚
โ”‚    307 โ”‚   โ”‚   return _sentencepiece.SentencePieceProcessor_serialized_model โ”‚
โ”‚    308 โ”‚                                                                     โ”‚
โ”‚    309 โ”‚   def LoadFromFile(self, arg):                                      โ”‚
โ”‚ โฑ  310 โ”‚   โ”‚   return _sentencepiece.SentencePieceProcessor_LoadFromFile(sel โ”‚
โ”‚    311 โ”‚                                                                     โ”‚
โ”‚    312 โ”‚   def _EncodeAsIds(self, text, enable_sampling, nbest_size, alpha,  โ”‚
โ”‚    313 โ”‚   โ”‚   return _sentencepiece.SentencePieceProcessor__EncodeAsIds(sel โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
RuntimeError: Internal: src/sentencepiece_processor.cc(1101) 
[model_proto->ParseFromArray(serialized.data(), serialized.size())] 

The versions of tokenizers and transformers are 0.13.3 and 4.28.0.dev0 respectively.

Could you help me out to solve this error?
Thanks,
Vishal

Segmentation Error

@shehanmunasinghe I was implementing the code locally but, I stuck with an error that says:

While debugging: Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)

While running through CLI: Segmentation fault (core dumped)

Also can you please let me know the minimum requirement to run inference?

Thank you in Advance

Training Details

What is the difference in training between this work and VideoChatGPT?

requirments conflicts for whisper-at and torch 2.1.0 during installation

which runing "pip install -r requirements.txt", here comes an error:
`ERROR: Cannot install -r requirements.txt (line 1) and -r requirements.txt (line 19) because these package versions have conflicting dependencies.

The conflict is caused by:
torch 2.1.0 depends on triton==2.1.0; platform_system == "Linux" and platform_machine == "x86_64"
whisper-at 0.5 depends on triton==2.0.0

To fix this you could try to:

  1. loosen the range of package versions you've specified
  2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts`

Demo on Gradio

Will there be a Gradio demo for this model similar to Video-LLaVA? It would be highly beneficial

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.