[Minor] Rename no_eos_trim to no_stop_trim (#1661)
This commit is contained in:
@@ -75,8 +75,8 @@ class DetokenizerManager:
|
||||
|
||||
self.decode_status = LimitedCapacityDict()
|
||||
|
||||
def trim_eos(self, output: Union[str, List[int]], finished_reason, no_eos_trim):
|
||||
if no_eos_trim:
|
||||
def trim_eos(self, output: Union[str, List[int]], finished_reason, no_stop_trim):
|
||||
if no_stop_trim:
|
||||
return output
|
||||
|
||||
# Trim stop str. TODO(lmzheng): handle the case where multiple stop strs are hit
|
||||
@@ -141,7 +141,7 @@ class DetokenizerManager:
|
||||
self.trim_eos(
|
||||
s.decode_ids[s.surr_offset :],
|
||||
recv_obj.finished_reason[i],
|
||||
recv_obj.no_eos_trim[i],
|
||||
recv_obj.no_stop_trim[i],
|
||||
)
|
||||
)
|
||||
surr_ids.append(s.decode_ids[s.surr_offset : s.read_offset])
|
||||
@@ -177,7 +177,7 @@ class DetokenizerManager:
|
||||
self.trim_eos(
|
||||
s.decoded_text + new_text,
|
||||
recv_obj.finished_reason[i],
|
||||
recv_obj.no_eos_trim[i],
|
||||
recv_obj.no_stop_trim[i],
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -295,7 +295,7 @@ class BatchTokenIDOut:
|
||||
spaces_between_special_tokens: List[bool]
|
||||
meta_info: List[Dict]
|
||||
finished_reason: List[BaseFinishReason]
|
||||
no_eos_trim: List[bool]
|
||||
no_stop_trim: List[bool]
|
||||
|
||||
|
||||
@dataclass
|
||||
|
||||
@@ -885,7 +885,7 @@ class Scheduler:
|
||||
output_read_offsets = []
|
||||
output_skip_special_tokens = []
|
||||
output_spaces_between_special_tokens = []
|
||||
output_no_eos_trim = []
|
||||
output_no_stop_trim = []
|
||||
else: # embedding or reward model
|
||||
output_embeddings = []
|
||||
unfinished_indices = []
|
||||
@@ -917,7 +917,7 @@ class Scheduler:
|
||||
output_spaces_between_special_tokens.append(
|
||||
req.sampling_params.spaces_between_special_tokens
|
||||
)
|
||||
output_no_eos_trim.append(req.sampling_params.no_eos_trim)
|
||||
output_no_stop_trim.append(req.sampling_params.no_stop_trim)
|
||||
|
||||
meta_info = {
|
||||
"prompt_tokens": len(req.origin_input_ids),
|
||||
@@ -968,7 +968,7 @@ class Scheduler:
|
||||
output_spaces_between_special_tokens,
|
||||
output_meta_info,
|
||||
output_finished_reason,
|
||||
output_no_eos_trim,
|
||||
output_no_stop_trim,
|
||||
)
|
||||
)
|
||||
else: # embedding or reward model
|
||||
|
||||
Reference in New Issue
Block a user