WHB139426 / Grounded-Video-LLM

Grounded-VideoLLM: Sharpening Fine-grained Temporal Grounding in Video Large Language Models
43 stars 3 forks source link

Error #3

Open Elliot-Construct opened 1 week ago

Elliot-Construct commented 1 week ago
Traceback (most recent call last):
  File "/path/to/inference.py", line 8, in <module>
    from datasets.chat.base_template import LLaMA3_Template, Vicuna_Template, Phi_3_5_Template, DEFAULT_IMAGE_TOKEN, GROUNDING_TOKEN
  File "/path/to/base_template.py", line 112, in <module>
    @dataclass
     ^^^^^^^^^
  File "/path/to/dataclasses.py", line 1232, in dataclass
    return wrap(cls)
           ^^^^^^^^^
  File "/path/to/dataclasses.py", line 1222, in wrap
    return _process_class(cls, init, repr, eq, order, unsafe_hash,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/dataclasses.py", line 958, in _process_class
    cls_fields.append(_get_field(cls, name, type, kw_only))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/dataclasses.py", line 815, in _get_field
    raise ValueError(f'mutable default {type(f.default)} for field '
ValueError: mutable default <class 'datasets.chat.base_template.StringFormatter'> for field format_image_token is not allowed: use default_factory

Error

I am getting this error while trying to get it running on WSL

WHB139426 commented 1 week ago

Hi. thanks for your interest in our work.

We have tested our code on Ubuntu 20.04.6 LTS (GNU/Linux 5.4.0-177-generic x86_64) and there is no problem. We haven't tested it on WSL environment. Have you tried to run it on native Linux environment?

Moreover, it looks like a Python syntax error. Are you sure the installed Python version is 3.10.14?

If none of the above methods work, you can try replacing lines 128 to 134 in datasets/chat/base_template.py with:

from dataclasses import field
@dataclass
class Phi_3_5_Template(Template):
    format_image_token: "Formatter" = field(default_factory=lambda: StringFormatter(slot=DEFAULT_IMAGE_TOKEN+"\n{{content}}"))
    format_user: "Formatter" = field(default_factory=lambda: StringFormatter(slot="\n<|user|>\n" + "{{content}}"))
    format_assistant: "Formatter" = field(default_factory=lambda: StringFormatter(slot="\n<|assistant|>\n"  + "{{content}}" + "<|endoftext|>"))
    system: "Formatter" = field(default_factory=lambda: EmptyFormatter(slot="<|system|>\nYou are a helpful AI assistant that can generate responses based on visual inputs."))
    separator: "Formatter" = EmptyFormatter(slot=['\n<|assistant|>\n', '<|endoftext|>'])