Run this model with HF Jobs

Run OpenGVLab/InternVL-Chat-V1-5 on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs and TRL to fine-tune https://huggingface.co/OpenGVLab/InternVL-Chat-V1-5. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/OpenGVLab/InternVL-Chat-V1-5 on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

Evaluate on a benchmark

Use HF Jobs to evaluate https://huggingface.co/OpenGVLab/InternVL-Chat-V1-5. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.

Quantize for lower memory use

Use HF Jobs to create a 4-bit version of https://huggingface.co/OpenGVLab/InternVL-Chat-V1-5. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.

BugFix: AttributeError: 'InternVLChatConfig' object has no attribute 'llm_config'

#29

When loading InternVideo2_5_Chat_8B model or InternVL2_5 series models:
It raises AttributeError: 'InternVLChatConfig' object has no attribute 'llm_config'
Please refer: https://huggingface.co/OpenGVLab/InternVideo2_5_Chat_8B/discussions/14

Simple Solution for InternVL Configuration Issue

(Tested with transformers v4.52.4)

Required Modifications

  1. Add Initialization (configuration_internvl_chat.py:49)

    self.vision_config = InternVisionConfig(**vision_config)
    self.llm_config = None  # Initialize llm_config to prevent AttributeError
    
  2. Add Null Check (configuration_internvl_chat.py:85)

    output['llm_config'] = self.llm_config.to_dict() if self.llm_config is not None else {}
    

Root Cause Analysis

When executing:

model = AutoModel.from_pretrained(model_path, trust_remote_code=True).half().cuda().to(torch.bfloat16)

The following occurs:

  1. The Hugging Face framework downloads and parses configuration_internvl_chat.py
  2. During config initialization (transformers/configuration_utils.py:816-822):
    config_dict = self.to_dict()
    
    # Get the default config dict (from a fresh PreTrainedConfig instance)
    default_config_dict = PretrainedConfig().to_dict()
    
    # get class specific config dict
    class_config_dict = self.__class__().to_dict() if not self.has_no_defaults_at_init else {}
    
  3. Key Issue:
    • self.llm_config is None during class_config_dict generation because llm_config is None
    • Without explicit initialization, this triggers an AttributeError when .to_dict() is called

Why the Fix Works

  1. The initialization ensures self.llm_config always exists (even as None)
  2. The null check prevents method calls on None while maintaining expected dictionary structure

Ready to merge
This branch is ready to get merged automatically.

Sign up or log in to comment