Can you check if this is the code you have now:
for name, module in model._modules.items():
    if name == 'encoder':
        for nname, submodule in module._modules.items():
            if nname == 'block3':
                for layer_name, layer in submodule._modules.items():
                    print(nname, layer) 
                    model.encoder.block3[int(layer_name)].register_forward_hook(get_activation(layer_name))