Hello @HyamsG ,
(Sorry for bumping an old thread.)
I came across the same question today. I used the fine-tuning tutorial with my own custom dataset and saw a prompt asking me to implement get_height_and_width.
The structure of the get_height_and_width function can be inferred from the tutorial’s group_by_aspect_ratio.py, in particular its _compute_aspect_ratios_custom_dataset() where it reads height, width = dataset.get_height_and_width(i).
In my case, I simply implemented like so:
    def get_height_and_width(self,idx):
        return self.img_data[idx]['height'],self.img_data[idx]['width']

which works for me so far.
Can’t answer on benefits of aspect ratio grouping and whether it’s commonly used.