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

AttributeError: 'LISAForCausalLM' object has no attribute 'ce_loss_weight' #85

Open
zifuwan opened this issue Nov 26, 2023 · 3 comments

Comments

@zifuwan
Copy link

zifuwan commented Nov 26, 2023

Hi, I'm trying to train the LISA-7B while stuck with this error:
AttributeError: 'LISAForCausalLM' object has no attribute 'ce_loss_weight'
This is because of the following codes in model/LISA.py:

        if not hasattr(config, "train_mask_decoder"):
            config.mm_use_im_start_end = kwargs.pop("use_mm_start_end", True)
            config.mm_vision_tower = kwargs.get(
                "vision_tower", "openai/clip-vit-large-patch14"
            )
            self.ce_loss_weight = kwargs.pop("ce_loss_weight", None)
            self.dice_loss_weight = kwargs.pop("dice_loss_weight", None)
            self.bce_loss_weight = kwargs.pop("bce_loss_weight", None)
        else:
            config.mm_vision_tower = config.vision_tower

Since in config, train_mask_decoder is set to True, so self.ce_loss_weight is not initialized. Is this a bug of the training code or did I make any mistake with the training config?

Thanks.

@X-Lai
Copy link
Contributor

X-Lai commented Dec 4, 2023

Hi, do you want to train further with LISA as the base model?

@zifuwan
Copy link
Author

zifuwan commented Dec 4, 2023

Hi, do you want to train further with LISA as the base model?

Hi, thanks for the reply.
Yes, I tried to run train_ds.py and met the issue.
I tried to solve it by changing if not hasattr(config, "train_mask_decoder"): to if hasattr(config, "train_mask_decoder"):, and afterward I could run the code. However, I still don't know why the original code had that issue.

@hxx-who
Copy link

hxx-who commented Dec 15, 2023

Hi, thanks for the reply. Yes, I tried to run train_ds.py and met the issue. I tried to solve it by changing if not hasattr(config, "train_mask_decoder"): to if hasattr(config, "train_mask_decoder"):, and afterward I could run the code. However, I still don't know why the original code had that issue.

Thanks a lot, I ran into the same problem and solved it by your method.

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

3 participants