Problem with torchvision dataset type information

Hi, been enjoying this library a lot, there are two single problems that I couldn’t solve:

  1. Warning keeps being printed
  2. Type information error for Dataset.

For the first one, I am using as recommended:

torchvision.disable_beta_transforms_warning()

But the warning keeps being printed ?

For the second one, this is a code example:

def train_loop(
    dataloader: DataLoader,
    model: nn.Module,
    loss_fn: torch.nn.CrossEntropyLoss,
    optimizer: torch.optim.Adam,
):
   # inside fn
    dataset_size = len(dataloader.dataset)  # type: ignore
   ...

Notice that I have to use type ignore or it complains with this error message:

Argument of type “Dataset[Unknown]” cannot be assigned to parameter “__obj” of type “Sized” in function “len”
“Dataset[Unknown]” is incompatible with protocol “Sized”
len” is not presentPylancereportGeneralTypeIssues


Help or pointers are highly appreciated ! Thank you !