Skip to content
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

Freeze embeddings #136

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Freeze embeddings #136

wants to merge 5 commits into from

Conversation

Nzteb
Copy link
Contributor

@Nzteb Nzteb commented Aug 22, 2020

Functionality to freeze embeddings during training as discussed with Adrian. A file containing ids for the entities or relations can be loaded, these embeddings are held constant during training. What is an open question is how the save/resume functionality for frozen models should be. Right now, the frozen and not-frozen parameters are saved. This requires loading functionality for a frozen model. An alternative would be to save the model as a standard model e.g. by unfreezing it first. This would, however, loose the optimizer state and a training process where parameters are held constant could not be continued.

@rgemulla
Copy link
Member

@adrian, do you want to do the initial review?

@rgemulla
Copy link
Member

rgemulla commented Aug 24, 2020

As for loading, I think the model should be stored as is (including the frozen parameters). Not sure what kind of "loading functionality" is required for this, though. Only the embedder is affected, right?

Copy link
Collaborator

@AdrianKs AdrianKs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Just some small points.
We should check if resuming still works correctly with frozen embeddings. Also we need to extend the package functionality (maybe not in this PR) to handle models with frozen embeddings.

kge/model/embedder/lookup_embedder.py Outdated Show resolved Hide resolved
kge/model/embedder/lookup_embedder.py Outdated Show resolved Hide resolved
kge/model/embedder/lookup_embedder.py Outdated Show resolved Hide resolved
kge/model/kge_model.py Outdated Show resolved Hide resolved
@Nzteb Nzteb force-pushed the freeze_embeddings branch 3 times, most recently from 48975fc to 57a651e Compare September 1, 2020 13:40
@Nzteb
Copy link
Contributor Author

Nzteb commented Sep 1, 2020

As it is now, models are saved with the frozen parameters and resuming the training works.

@AdrianKs AdrianKs mentioned this pull request May 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants