It worked normally in my environment with 4.49.0dev. I think the code is outdated.
tensor([[[0.8896, 0.7523, 0.2491]]], grad_fn=)
I’m not very familiar with it, but Transformers seems to have been significantly revamped in 4.49.0 and 4.50.0, so I think it should work if you specify the following version for now.
pip install transformers<4.49.0
or
pip install transformers<=4.49.0