Great! It works now. All layers of block3 are printed out (I had to restart the notebook kernel).
Thanks a lot!
this_block = model.encoder.block3
for layer_name, layer in this_block._modules.items():
    print(layer_name, layer)
    model.encoder.block3[int(layer_name)].register_forward_hook(get_activation(layer_name))