Repository: activeloopai/Hub
File: deeplake/integrations/pytorch/pytorch.py (Python)

Code before:
    import torch
    from deeplake.integrations.pytorch.dataset import TorchDataset

    try_flushing(dataset)

    torch.multiprocessing.set_sharing_strategy("file_system")

    if collate_fn is None:
        collate_fn = default_convert_fn if batch_size is None else default_collate_fn

    if tensors is not None and "index" in tensors:
        raise ValueError("index is not a tensor, to get index, pass return_index=True")

    if isinstance(transform, dict):
        tensors = [k for k in transform.keys() if k != "index"]
        transform = PytorchTransformFunction(transform_dict=transform)
    else:
        transform = PytorchTransformFunction(composite_transform=transform)

    if tensors is None:
        tensors = dataset.tensors

    for t in tensors:
        if dataset[t].is_sequence:
            raise NotImplementedError(
                f"Deep Lake’s OSS pure-python dataloader is not compatible with tensor `{t}` with htype = sequence[…]. Please use the C++ dataloader via ds.dataloader(…)"
            )

    tensors = map_tensor_keys(dataset, tensors)

    if shuffle and num_workers > 0:
        return create_dataloader(
            dataset,
            tensors,
            use_local_cache,
            transform,
            num_workers,
            buffer_size,
            batch_size,
            collate_fn,
            pin_memory,
            drop_last,
            return_index,
            pad_tensors,
            decode_method,
            persistent_workers,
            cache_size,
        )
    else:
        return torch.utils.data.DataLoader(
            TorchDataset(

Review comment (performance):
Instead of C++ dataloader, let's say 'high-performance dataloader'. That's consistent with language Levon is using in indra

Code after:
    import torch
    from deeplake.integrations.pytorch.dataset import TorchDataset

    try_flushing(dataset)

    torch.multiprocessing.set_sharing_strategy("file_system")

    if collate_fn is None:
        collate_fn = default_convert_fn if batch_size is None else default_collate_fn

    if tensors is not None and "index" in tensors:
        raise ValueError("index is not a tensor, to get index, pass return_index=True")

    if isinstance(transform, dict):
        tensors = [k for k in transform.keys() if k != "index"]
        transform = PytorchTransformFunction(transform_dict=transform)
    else:
        transform = PytorchTransformFunction(composite_transform=transform)

    if tensors is None:
        tensors = dataset.tensors

    for t in tensors:
        if dataset[t].is_sequence:
            raise NotImplementedError(
                f"Deep Lake’s OSS pure-python dataloader is not compatible with tensor `{t}` with htype = sequence[…]. Please use the high-performance dataloader via ds.dataloader(…)"
            )

    tensors = map_tensor_keys(dataset, tensors)

    if shuffle and num_workers > 0:
        return create_dataloader(
            dataset,
            tensors,
            use_local_cache,
            transform,
            num_workers,
            buffer_size,
            batch_size,
            collate_fn,
            pin_memory,
            drop_last,
            return_index,
            pad_tensors,
            decode_method,
            persistent_workers,
            cache_size,
        )
    else:
        return torch.utils.data.DataLoader(
            TorchDataset(