How to implement Factory Pattern with Lightning CLI and YAML Files?

I wish to to separate the training logic (which is encapsulated in the Lightning Module) and the actual model. Thus I want to pass a model to the initializer. Is it possible to do this with lightning cli and a yaml file?

I am imagining something like this:

model:
  class_path: path_to_lightning_module.MyLightningModule
  init_args:
    model :
      class_path: path_to_model.MyModel

However this does not work. Is there another way to achieve this?