Creating a custom Multi Task model using a custom config

Hello everyone,

I am currently setting up a custom Multi Task model returning three different class predictions for three tasks simultaneously. Now, this model needs a custom config class to ease the process of creating instances of this model.

The problem I am facing is that the __init__ function of the standard PretrainedConfig class, which I am subclassing for my custom config class, imposes certain constraints on the num_labels, id2label and label2id values. (see here)

The constraints are that id2label and label2id need to be dictionaries and that the length of id2label needs to be the same value as num_labels.

In a Multi Task setting these constraints do not make any sense, since you need to save multiple id2label and label2id dictionaries and num_label values (for each task you have your own set of id2label, label2id and num_label).

How am i supposed to make this work? Is PretrainedConfig by definition not supposed to be used for Multi Task models? Am i missing something?

All and every help/discussion is highly appreciated!

1 Like