Train Mask2Former model using Trainer class

Hey guys,

I created a Mask2Former model following this notebook here for finetuning on my custom dataset. Since the model is too big to run on a single GPU I want to use multiple GPUs (I have a total of 4 GPUs available). The easiest solution I found was to use the Trainer class for this problem. Is that correct?

If so, my question would be: How can I add the Trainer class to my model and use it for training?
Which steps do I need to do if my code is based on the above mentioned notebook?
I am quite new to Huggingface, so please be patient with me :blush: …

Any help is appreciated. Thank you so much.