Part 8 (5 points, coding task)
In this part, we prepare our CLIP dataset.
-
Define class
MyDataset
that subclassesDataset
.-
__init__
-
Inputs:
images_pt
,token_id_list
. -
Attributes: Same as inputs.
-
-
__len__
- Output: total number of samples.
-
__getitem__
-
Input: sample index
idx
-
Outputs:
images_pt[idx]
,token_id_list[idx]
-
-
-
Define dataset
CLIP_dataset
that is an object ofMyDataset
.