a horrible function in `modeling_mobilellm.py`

#5
by J22 - opened

if not (...., False) is killing me.

    def get_output_embeddings(self):
        return (
            self.lm_head
            if not getattr(self.config, "share_embedding", False)
            else self.get_input_embeddings()
        )

I would do it this way:

    def get_output_embeddings(self):
        return (
            self.get_input_embeddings()
            if getattr(self.config, "share_embedding", False)
            else self.lm_head
        )

This is even better, but default value is changed:

    def get_output_embeddings(self):
        return (
            self.get_input_embeddings()
            if getattr(self.config, "share_embedding", True)
            else self.lm_head
        )
AI at Meta org

Thanks for pointing that out. πŸ˜† We modified modeling.py!

zechunliu changed discussion status to closed

Sign up or log in to comment