How to load data for hierarchical multi label classificationa

I have a classification task where I have a parent class and 3 subclasses
and each for subclasses takes 2 labels also “label1.1” and “label2.1”
the prediction of the parent class depends on the prediction of the subclasses
my question is how should I pass the images along with their labels to the model

As a first attempt for all the images I created a csv file with this structure for each of the images

    file_id , label1 , label2

and then used dataloaders to pass it to a multioutput model
but now I have to add a parent class.the first thought that came to my mind was to create another csv file with this structure

    parent_id , label_value 

But I didn’t know how to proceed ?