open-compass / VLMEvalKit

Open-source evaluation toolkit of large vision-language models (LVLMs), support ~100 VLMs, 40+ benchmarks
https://huggingface.co/spaces/opencompass/open_vlm_leaderboard
Apache License 2.0
1.08k stars 154 forks source link

[Fix] Add packages to `requirements.txt` to Resolve Import Errors in `VLMEvalKit` #425

Closed Mor-Li closed 4 weeks ago

Mor-Li commented 4 weeks ago

This PR addresses multiple import errors encountered during the execution of the run.py script in the VLMEvalKit project. The errors were caused by missing dependencies that were being imported in the code but were not listed in the requirements.txt file.

Reason for the Change:

The following errors were observed in the logs when running the script:

  1. ModuleNotFoundError: No module named 'decord'

    • This error occurs due to the import statement from decord import VideoReader, cpu in the mvbench.py file. The decord package is necessary for handling video data and should be explicitly included in the requirements.txt file.
  2. ModuleNotFoundError: No module named 'imageio'

    • This error arises from the import imageio statement in the mvbench.py file. The imageio package is essential for reading and writing image data, and it should also be added to the requirements.txt file.
  3. ModuleNotFoundError: No module named 'peft'

    • This error occurs due to the import statement from peft import get_peft_model, LoraConfig, TaskType in the vlm.py file. The peft package is essential for working with parameter-efficient fine-tuning (PEFT) models and must be included in the requirements.txt file.
  4. ModuleNotFoundError: No module named 'moviepy'

    • This error is related to the import statements from moviepy.editor import VideoFileClip, ImageSequenceClip and import moviepy.config_defaults in the mvbench.py file. The moviepy package is essential for video editing operations and needs to be included in the requirements.txt file.

Code Stack Trace:

The relevant stack trace showing the import errors is as follows:

Traceback (most recent call last):
  File "/cpfs01/user/limo/workspace/VLMEvalKit/run.py", line 4, in <module>
    from vlmeval.config import supported_VLM
  File "/cpfs01/user/limo/workspace/VLMEvalKit/vlmeval/__init__.py", line 7, in <module>
    from .api import *
  File "/cpfs01/user/limo/workspace/VLMEvalKit/vlmeval/api/__init__.py", line 8, in <module>
    from vlmeval.dataset import DATASET_TYPE
  File "/cpfs01/user/limo/workspace/VLMEvalKit/vlmeval/dataset/__init__.py", line 20, in <module>
    from .mvbench import MVBench, MVBench_MP4
  File "/cpfs01/user/limo/workspace/VLMEvalKit/vlmeval/dataset/mvbench.py", line 11, in <module>
    from decord import VideoReader, cpu
ModuleNotFoundError: No module named 'decord'

Traceback (most recent call last):
  File "/cpfs01/user/limo/workspace/VLMEvalKit/vlmeval/dataset/mvbench.py", line 11, in <module>
    import imageio
ModuleNotFoundError: No module named 'imageio'

Traceback (most recent call last):
  File "/cpfs01/user/limo/workspace/VLMEvalKit/vlmeval/vlm/__init__.py", line 35, in <module>
    from peft import get_peft_model, LoraConfig, TaskType
ModuleNotFoundError: No module named 'peft'

Traceback (most recent call last):
  File "/cpfs01/user/limo/workspace/VLMEvalKit/vlmeval/dataset/mvbench.py", line 12, in <module>
    from moviepy.editor import VideoFileClip, ImageSequenceClip
ModuleNotFoundError: No module named 'moviepy'

Changes Made:

By including these packages in the requirements.txt, we ensure that all necessary dependencies are installed, preventing the aforementioned ModuleNotFoundError from occurring during runtime. This update is critical for maintaining the stability and functionality of the VLMEvalKit project.