Skip to content

Training fails with tons of missing imports in llava_trainer.py #483

@peterwisu

Description

@peterwisu

I'm trying to train a model but in llava/train/llava_trainer.py file. It has broken imports everywhere.

I follow the installation in the Readme.md

conda create -n llava python=3.10 -y
conda activate llava
pip install --upgrade pip # Enable PEP 660 support.
pip install -e ".[train]"

But when I ran
LLaVA-NeXT/scripts/train/pretrain_siglip.sh

which will called llava/train/train_mem.py -> train.py -> llava_trainer.py

I get error like:

NameError: name 'get_model_param_count' is not defined
NameError: name 'is_torch_xla_available' is not defined
NameError: name 'DistributedType' is not defined
NameError: name 'DebugOption' is not defined

Which cause from trainer file is missing imports for functions that are actually used in the code. Functions are called but never imported anywhere.
I had to manually add these imports just to get past the first few errors:

from transformers.debug_utils import DebugOption, DebugUnderflowOverflow
from transformers.integrations import deepspeed_init
from transformers import TrainerState
from transformers.trainer_pt_utils import get_model_param_count
from transformers.utils import is_torch_xla_available
from accelerate.utils import DistributedType
import math
import time
import numpy as np
import sys

Is this a bug in the code or am I missing something in my installation/setup?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions