LISA icon indicating copy to clipboard operation
LISA copied to clipboard

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

Open zifuwan opened this issue 1 year ago • 3 comments

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.

zifuwan avatar Nov 26 '23 23:11 zifuwan

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

X-Lai avatar Dec 04 '23 13:12 X-Lai

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.

zifuwan avatar Dec 04 '23 23:12 zifuwan

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.

hxx-who avatar Dec 15 '23 11:12 hxx-who