Lightning-Universe/lightning-transformers

What do you guys think about having this in a method called set model?

espoirMur opened this issue · 2 comments

https://github.com/Lightning-AI/lightning-transformers/blob/7c691e77c9e8828405b8495ae6a69dc4887e29ec/lightning_transformers/core/model.py#L58

  if load_weights:
            self.model = downstream_model_type.from_pretrained(pretrained_model_name_or_path, **model_data_kwargs)
        else:
            config = AutoConfig.from_pretrained(pretrained_model_name_or_path, **model_data_kwargs)
            self.model = downstream_model_type.from_config(config)

First of all thanks you for putting this module in place, I wish I knew it a bit earlier.

Just a suggestion, what you guys think about wrapping the above code in a method call set_model

This can help in case , where the model was not directly from hugging face. For example, I am playing with a model that was customized and has a custom initialization method. In those cases, it can be useful to override the set_model and keep using the code.

If you guys are okay with this approach I can make a pull request on the weekend to suggest the change.

Regarrds.

Sounds great! Thanks for making this issue, would appreciate a PR ❤️

Okay, I will hack on it on Sunday..