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

(WIP) compute the backward pass only once for all three slots in negative sampling #141

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AdrianKs
Copy link
Collaborator

Add Flag to negative sampling to compute positive scores and backward pass only once for all three slots.

Unsure how to handle reciprocal relations in this setup. Can not provide direction, when scoring positive triples.

@AdrianKs AdrianKs requested a review from rgemulla August 31, 2020 08:41
@@ -312,6 +312,13 @@ negative_sampling:
# 'triple' (e.g., for TransE or RotatE in the current implementation).
implementation: triple

# Whether to compute the backward pass after scoring against each slot (S, P, O)
# or once after scoring against all three slots.
# Does not work with reciprocal relations.
Copy link
Member

Choose a reason for hiding this comment

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

Move to "false".

Copy link
Member

Choose a reason for hiding this comment

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

Also say that if false, positive triples are scored only once (else once per slot).

@rgemulla
Copy link
Member

Another thought: shouldn't we allow this for all trainers? We may either push the backward pass into _process_batch (slow, save mem) or keep it outside (fast, more mem).

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.

2 participants