FARM icon indicating copy to clipboard operation
FARM copied to clipboard

Combine several models into one with several prediction heads

Open LeonardoSanBenitez opened this issue 2 years ago • 2 comments

Question Is it possible to combine several models into one with several prediction heads?

Additional context I have independly trained several adaptative models, all of them using the same language model Each adaptative model have one text classification prediction head I would like to merge/join/aggregate the several adaptative models into one, with multiple prediction heads

There is this similar question https://github.com/deepset-ai/FARM/issues/441#issuecomment-653424408 but the answers weren't clear to me

I expected that it would be something along these lines:

model1 = Inferencer.load('model1', task_type="text_classification")
model2 = Inferencer.load('model2', task_type="text_classification")

model2.model.prediction_heads.append(model1.model.prediction_heads[0])

and then when performing inferences with this new model I would receive the result of both model1 and model2. But this doesn't work: the inference outputs empty arrays.

Thank you very much in advance.

LeonardoSanBenitez avatar Mar 31 '22 00:03 LeonardoSanBenitez

Sorry, we do not actively maintain this project any longer, unfortunately, see https://github.com/deepset-ai/FARM/commit/2fc801d1d0c973cb36bc867907d4250d1084493b

Timoeller avatar Mar 31 '22 15:03 Timoeller

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 21 days if no further activity occurs.

stale[bot] avatar Jul 30 '22 17:07 stale[bot]