This is most likely caused by diverged torchvision
and PyTorch versions.
Based on the error message it seems you might be using a newer torchvision
installation with an older PyTorch version, which doesn’t provide the torch.jit._script_if_tracing
context manager.
Could you update both libs to the stable or nightly versions and rerun the code?