one can also reference the model inside ddp and work on the reference to avoid ddp.modul.attr.
so, the optimizer can work on ddp, but you can do everything else over the reference.
see this 18.
the example 14.