I am still not sure why the hook_fn as defined above doesn’t print anything, but I have identified the problem: I was not following the correct convention for padding_mask : True or 1 should mean “ignore/pad” and False or 0 should mean “consider”