Refactor: Move return_hidden_states to the generate input (#3985)
Co-authored-by: Beichen-Ma <mabeichen12@gmail.com>
This commit is contained in:
@@ -69,11 +69,15 @@ class GenerateReqInput:
|
||||
|
||||
# Session info for continual prompting
|
||||
session_params: Optional[Union[List[Dict], Dict]] = None
|
||||
|
||||
# Custom logit processor for advanced sampling control. Must be a serialized instance
|
||||
# of `CustomLogitProcessor` in python/sglang/srt/sampling/custom_logit_processor.py
|
||||
# Use the processor's `to_str()` method to generate the serialized string.
|
||||
custom_logit_processor: Optional[Union[List[Optional[str]], str]] = None
|
||||
|
||||
# Whether to return hidden states
|
||||
return_hidden_states: bool = False
|
||||
|
||||
def normalize_batch_and_arguments(self):
|
||||
if (
|
||||
self.text is None and self.input_ids is None and self.input_embeds is None
|
||||
@@ -218,6 +222,7 @@ class GenerateReqInput:
|
||||
if self.custom_logit_processor is not None
|
||||
else None
|
||||
),
|
||||
return_hidden_states=self.return_hidden_states,
|
||||
)
|
||||
|
||||
|
||||
@@ -255,6 +260,9 @@ class TokenizedGenerateReqInput:
|
||||
# Use the processor's `to_str()` method to generate the serialized string.
|
||||
custom_logit_processor: Optional[str] = None
|
||||
|
||||
# Whether to return hidden states
|
||||
return_hidden_states: bool = False
|
||||
|
||||
|
||||
@dataclass
|
||||
class EmbeddingReqInput:
|
||||
|
||||
Reference in New Issue
Block a user