First check your transformers version, and then ensure you’re using the correct kernel/environment and dependencies like torch (or tensorflow) installed / compatible and restart the kernel / clear caches. Try a minimal repro
transformers
torch
tensorflow