Torch.jit.save not working on some models from Torchhub

Hi! I’m having issues with exporting some models from Torchhub to Torchscript.

For example, if I try:

model_name = "x3d_xs"  # this does NOT work
model_name = "i3d_r50"  # this works
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")

model = torch.hub.load("facebookresearch/pytorchvideo", model_name, pretrained=True).to(device)

# train your model here...

torch.jit.save(torch.jit.script(model), "some_saved_model.pt")

this works totally fine for models such as “i3d_r50”, but if I try models like “x3d_s” or “x3d_xs”, I get the error:

File "[...]/lib/python3.10/site-packages/torch/jit/annotations.py", line 513, in ann_to_type
    raise ValueError(f"Unknown type annotation: '{ann}' at {loc.highlight()}")
ValueError: Unknown type annotation: '<class 'torch.nn.modules.module.Module'>' at 
python-BaseException

I did have this issue first when replacing the last layer of the model to classify on custom classes, but the behaviour is the same even if I leave the model as it is.
Am I doing something wrong here?