My guess is that model.add_module(...) is not working as you expect.
Can I suggest a refactor?
First make a list of submodules…
modules = []
for layer in list(cnn):
    ...
    # instead of model.add_module(name, layer)
    modules.append(layer)

then create the model with the list of submodules
model = nn.Sequential(modules)