You could iterate all submodules, check if the current module is an nn.Dropout layer via isinstance, and set p accordingly.
The cleanest way would probably be to write a custom function which is similar to a weight_init method and call it via model.apply.