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

⬇️🎖️ Low rank embeddings #680

Merged
merged 16 commits into from
Dec 12, 2021
Merged

⬇️🎖️ Low rank embeddings #680

merged 16 commits into from
Dec 12, 2021

Conversation

mberr
Copy link
Member

@mberr mberr commented Dec 12, 2021

This PR adds a representation module, which factorizes the Embedding matrix into a matrix of basis representations, and trainable linear weights.

It is an alternative way to reduce the number of trainable parameters, while keeping the embedding dimension.

  • It is essentially the same as
    class BasesDecomposition(Decomposition):
    r"""Represent relation-weights as a linear combination of base transformation matrices.
    The basis decomposition represents the relation-specific transformation matrices
    as a weighted combination of base matrices, $\{\mathbf{B}_i^l\}_{i=1}^{B}$, i.e.,
    .. math::
    \mathbf{W}_r^l = \sum \limits_{b=1}^B \alpha_{rb} \mathbf{B}^l_i
    """

so there may be some potential to reduce duplication. -> 78d9b62

@@ -594,197 +653,6 @@ def _handle(
return value


class RGCNRepresentations(RepresentationModule):
Copy link
Member Author

Choose a reason for hiding this comment

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

I had to move this one to avoid cyclic imports

@mberr mberr requested a review from cthoyt December 12, 2021 14:08
@mberr mberr changed the title Low rank embeddings ⬇️🎖️ Low rank embeddings Dec 12, 2021
Copy link
Member

@cthoyt cthoyt left a comment

Choose a reason for hiding this comment

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

🚨🚨 IT'S THE DOCUMENTATION POLICE, OPEN UP 🚨🚨

besides the notes on improving the docs, I think this all looks solid. the moves for the circular imports make sense though they make me wonder if we should adopt pytorch-like way of just importing everything in pykeen.nn

@cthoyt
Copy link
Member

cthoyt commented Dec 12, 2021

@PyKEEN-bot test

@mberr
Copy link
Member Author

mberr commented Dec 12, 2021

@PyKEEN-bot test

@mberr mberr merged commit 58119f1 into master Dec 12, 2021
@mberr mberr deleted the low-rank-embedding branch December 12, 2021 17:28
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