deepset-ai / FARM

:house_with_garden: Fast & easy transfer learning for NLP. Harvesting language models for the industry. Focus on Question Answering.
https://farm.deepset.ai
Apache License 2.0
1.73k stars 247 forks source link

Combine several models into one with several prediction heads #856

Closed LeonardoSanBenitez closed 1 year ago

LeonardoSanBenitez commented 2 years ago

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.

Timoeller commented 2 years ago

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

stale[bot] commented 2 years ago

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.