Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Applied black on torch generator agent to fix CI failure. #4684

Merged
merged 1 commit into from
Jul 25, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions parlai/core/torch_generator_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,14 @@ def add_cmdline_args(
)
agent.add_argument(
'--inference',
choices={'beam', 'greedy', 'topk', 'nucleus', 'delayedbeam', 'delayednucleusbeam'},
choices={
'beam',
'greedy',
'topk',
'nucleus',
'delayedbeam',
'delayednucleusbeam',
},
default='greedy',
help='Generation algorithm',
)
Expand Down Expand Up @@ -1886,7 +1893,9 @@ def __init__(self, p, delay, *args, **kwargs):

def select_paths(self, logprobs, prior_scores, current_length) -> _PathSelection:
if current_length < self.delay:
return NucleusSampling.select_paths(self, logprobs, prior_scores, current_length)
return NucleusSampling.select_paths(
self, logprobs, prior_scores, current_length
)
else:
return BeamSearch.select_paths(self, logprobs, prior_scores, current_length)

Expand Down