This repository has been archived by the owner on Nov 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
[BlenderBot2] A hybrid mode (skip search when needed) #4221
Merged
Merged
Changes from 3 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
a4125c2
hybrid
ffeddb1
lint
2dd81be
the fid search agent
mojtaba-komeili 7f14a17
the added teacher with skip search
mojtaba-komeili 463cbe2
reformat
mojtaba-komeili f1140aa
renamed the skip search param + nits
mojtaba-komeili 158a121
fix task test failures
f3166e4
ci config
f0a5075
del 1 test
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -181,7 +181,7 @@ def __init__(self, opt: Opt): | |
) | ||
assert isinstance(base_agent, TorchAgent) | ||
self.agents = [base_agent] | ||
bsz = max(opt.get('batchsize', 1), opt.get('eval_batchsize', 1)) | ||
bsz = max(opt.get('batchsize') or 1, opt.get('eval_batchsize') or 1) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm interesting, I thought anything return from opt.get(XXX, 1) would never be None There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it can be |
||
rag_turn_n_turns = opt.get('rag_turn_n_turns', 1) | ||
if bsz > 1 or rag_turn_n_turns > 1: | ||
self.agents += [ | ||
|
@@ -196,6 +196,7 @@ def classify_retrieval( | |
input: torch.LongTensor, | ||
num_memories: torch.LongTensor, | ||
generated_memories: Optional[List[List[str]]], | ||
skip_search: Optional[torch.BoolTensor], | ||
) -> Tuple[torch.LongTensor, List[str]]: | ||
""" | ||
Classify input and get retrieval type. | ||
|
@@ -242,6 +243,8 @@ def classify_retrieval( | |
self.retrieval_type[i] = RetrievalType.MEMORY.value | ||
elif strip_punc(s) in NONE_STRINGS + MEMORY_STRINGS: | ||
self.retrieval_type[i] = RetrievalType.NONE.value | ||
elif skip_search is not None and skip_search[i]: | ||
self.retrieval_type[i] = RetrievalType.NONE.value | ||
else: | ||
self.retrieval_type[i] = RetrievalType.SEARCH.value | ||
searches.append(s) | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍