-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to save and load a tasknet model? #3
Comments
Hi! Currently, if you want to start again, you should load the saved encoder, and fill in the adapter weights one by one with a loop The training is multi-task, but the model use is typically single task, what is your use case ? |
Thanks! I will try loading the encoder and adapters separately. Eventually my use case will be to train a model that can do both sentence similarity and token classification, but I at the moment I am just trying to find a multi-task training module that works without problems. So far tasknet looks most promising. I guess tasknet does not support sentence similarity at the moment, but looking at the currently supported task implementations, it should not be too hard to add. |
To clarify the use case, I eventually want to implement a microservice that loads the trained encoder and trained adapters from local files so that encoder is common for the 2 tasks. |
Sentence similarity is already supported, just use tn.Classification template where y is float. So it should work off the shelf. Line 137 in 2d1c49e
|
Currently, if I call Is it possible to load the 4 tasks so that the encoder would be shared again? My aim is to avoid excessive memory consumption when I have multiple tasks that could use a shared encoder.
|
Currently, when the model is saved, it saves a single encoder + a set of adapters. Then, you can load the single encoder and set of adapters, and use |
Hi, Is there a way to combine all tasks into one model in the inference step? |
You should use task_model_list https://github.com/sileod/tasknet/blob/main/src/tasknet/models.py#L188 |
Hi! I tried the basic 3-task example from the README file, and the training worked fine. Then I tried to save and load the model:
Saving the model worked ok:
But loading the model gives an error:
I wonder what is the correct way to save and load the model?
The text was updated successfully, but these errors were encountered: