[srt] Inject "__req__" into custom_params only for custom logit processors (#43181)
Co-authored-by: joshuadeng <joshuadeng@users.noreply.github.com>
This commit is contained in:
co-authored by
joshuadeng
parent
4ee3f0f370
commit
7859eff6ca
@@ -1110,8 +1110,10 @@ class Req(ReqDllmMixin):
|
||||
self._think_end_matcher: Optional[TokenSequenceMatcher] = None
|
||||
self._think_end_match_len = 0
|
||||
|
||||
# Sampling info
|
||||
if isinstance(sampling_params.custom_params, dict):
|
||||
# Only custom logit processors need the "__req__" reference cycle.
|
||||
if custom_logit_processor is not None and isinstance(
|
||||
sampling_params.custom_params, dict
|
||||
):
|
||||
sampling_params = copy.copy(sampling_params)
|
||||
sampling_params.custom_params = sampling_params.custom_params | {
|
||||
"__req__": self
|
||||
|
||||
@@ -25,10 +25,8 @@ try:
|
||||
except ImportError:
|
||||
import sre_parse # Python < 3.11
|
||||
|
||||
# JSON-safe value types for custom_params. Must survive msgpack IPC
|
||||
# without PickleWrapper. After deserialization on the scheduler side,
|
||||
# Req.__init__ injects "__req__" (a Req object) into the dict in-process;
|
||||
# that augmented dict is never re-serialized.
|
||||
# JSON-safe value types for custom_params. Must survive msgpack IPC
|
||||
# without PickleWrapper.
|
||||
_JsonScalar = Union[None, bool, int, float, str]
|
||||
CustomParamValue = Union[
|
||||
_JsonScalar,
|
||||
|
||||
Reference in New Issue
Block a user