Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

constants.py is missing #4

Open
hyun95roh opened this issue Nov 13, 2024 · 1 comment
Open

constants.py is missing #4

hyun95roh opened this issue Nov 13, 2024 · 1 comment

Comments

@hyun95roh
Copy link

hyun95roh commented Nov 13, 2024

According to readme, this is the code for training:

(llama3-ft) python train.py --dataset_path path/to/dataset.json --output_dir path/to/output_dir --text_model_id="meta-llama/Meta-Llama-3-8B-Instruct" --vision_model_id="openai/clip-vit-large-patch14" --batch_size 32

I ran the code above on my llama3-ft conda env (I changed my path indeed) but I met an error.
Here is the error message:

Traceback (most recent call last):
  File "C:\Users\nht95\OneDrive\Python\VScode\llama-multimodal-vqa\src\train.py", line 12, in <module>
    from dataset.data_handling import create_dataset
  File "C:\Users\nht95\OneDrive\Python\VScode\llama-multimodal-vqa\src\dataset\data_handling.py", line 1, in <module>
    from dataset.data_classes import SupervisedDataset, DataCollatorForSupervisedDataset
  File "C:\Users\nht95\OneDrive\Python\VScode\llama-multimodal-vqa\src\dataset\data_classes.py", line 11, in <module>
    from dataset.data_utils import preprocess_multimodal
  File "C:\Users\nht95\OneDrive\Python\VScode\llama-multimodal-vqa\src\dataset\data_utils.py", line 8, in <module>
    from constants import IGNORE_INDEX, IMAGE_TOKEN, PAD_TOKEN
ModuleNotFoundError: No module named 'constants'

Even after installing constants.py through pip install constants, the error message occurs:

Traceback (most recent call last):
  File "C:\Users\nht95\OneDrive\Python\VScode\llama-multimodal-vqa\src\train.py", line 12, in <module>
    from dataset.data_handling import create_dataset
  File "C:\Users\nht95\OneDrive\Python\VScode\llama-multimodal-vqa\src\dataset\data_handling.py", line 1, in <module>
    from dataset.data_classes import SupervisedDataset, DataCollatorForSupervisedDataset
  File "C:\Users\nht95\OneDrive\Python\VScode\llama-multimodal-vqa\src\dataset\data_classes.py", line 10, in <module>
    from constants import IGNORE_INDEX
ImportError: cannot import name 'IGNORE_INDEX' from 'constants' (C:\Users\nht95\anaconda3\envs\llama3-ft\Lib\site-packages\constants.py)

On top of that I also found out that this module cannot be found.

from llava_conversation_lib import conv_templates, SeparatorStyle
@SriPrarabdha
Copy link

SriPrarabdha commented Nov 20, 2024

@hyun95roh these files are present in src/utils folder so in order to fix this issue simply modify
line 10 in src/dataset/data_classes.py to :
from utils.constants import IGNORE_INDEX

line 8,9 in src/dataset/data_utils.py to :
from utils.constants import IGNORE_INDEX, IMAGE_TOKEN, PAD_TOKEN
from utils.llava_conversation_lib import conv_templates, SeparatorStyle

and finally at line 3 in src/model/configuration_llama.py to :
from utils.constants import LORA_CONFIG

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants