def __len__(self):
        """Return the length of the dataset."""
        num_samples = len(self.data)
        if self.max_samples is not None:
            # if max_samples is not None, return the min of num_samples and max_samples
            num_samples = min(num_samples, self.max_samples)
        return num_samples
Return the length of the dataset.
olive/data/component/dataset.py