By reading through the source (torch.optim.adam — PyTorch 1.9.1 documentation), these values are defined as exp_avg and exp_avg_sq, you should be able to access via something like this,
for group in optim.param_groups:
  for p in group['params']:
    state = optim.state[p]
    print(state['exp_avg'], state['exp_avg_sq'])