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

fix bugs in dual #34

Merged
merged 6 commits into from
Nov 18, 2024
Merged

fix bugs in dual #34

merged 6 commits into from
Nov 18, 2024

Conversation

bpiwowar
Copy link
Collaborator

No description provided.

Copy link
Contributor

@Mosakana Mosakana left a comment

Choose a reason for hiding this comment

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

add merge function for TextsRepresentationOutput class.

Copy link
Collaborator Author

@bpiwowar bpiwowar left a comment

Choose a reason for hiding this comment

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

And don't forget to run pre-commit before commit

@@ -67,6 +67,13 @@ class Dense(DualVectorScorer[QueriesRep, DocsRep]):
"""A scorer based on a pair of (query, document) dense vectors"""

def score_product(self, queries, documents, info: Optional[TrainerContext] = None):
# logger.info(f'info : {info} \n')
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Please remove

@@ -170,6 +177,13 @@ def __call__(self, info: TrainerContext, queries, documents):
# Assumes that all weights are positive
assert info.metrics is not None

#####################################################
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

remove the comments

return TextsRepresentationOutput(torch.cat(list(map(lambda x: x.value, objects))), TokenizedTexts(tokens, ids, lens, mask, token_type_ids))


################################################################################
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

remove this line

@@ -92,7 +92,39 @@ def merge(self, objects: Union[DocsRep, QueriesRep]):

if isinstance(objects[0], List):
return list(itertools.chain(objects))

################################################################################
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

remove this line

@bpiwowar bpiwowar merged commit 6e49a2d into experimaestro:master Nov 18, 2024
0 of 4 checks passed
@bpiwowar bpiwowar deleted the fix-some-bugs branch November 18, 2024 10:31
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