examples/research_projects/jax-projects/hybrid_clip/run_hybrid_clip.py/ImageTextDataset/__init__
class ImageTextDataset:    def __init__(
        self,
        root: str,
        file_path: str,
        captions_per_image=2,
        transform: Optional[Callable] = None,
        target_transform: Optional[Callable] = None,
        transforms: Optional[Callable] = None,
    ):
        super().__init__(root, transforms, transform, target_transform)

        with open(file_path, "r") as f:
            examples = [json.loads(line) for line in f.readlines()]

        self.captions = []
        self.image_paths = []

        for example in examples:
            captions_subset = example["captions"][:captions_per_image]
            self.captions.extend(captions_subset)
            self.image_paths.extend([example["image_path"]] * len(captions_subset))