@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 226a4272cf
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 15, 11:00 UTC

[V1] Improve VLLM_ALLOW_INSECURE_SERIALIZATION logging (#17860)

Signed-off-by: Russell Bryant <rbryant@redhat.com>

Russell Bryant committed May 8, 2025 at 12:57 UTC 226a4272cf6d184f20c6638f29a409347c6c474b
1 file changed +10 -7
vllm/v1/serial_utils.py
+10 -7
@@ -40,6 +40,11 @@ MMF_CLASS_TO_FACTORY: dict[type[BaseMultiModalField], str] = {
40 bytestr = Union[bytes, bytearray, memoryview, zmq.Frame]
41
42
43 +def _log_insecure_serialization_warning():
44 + logger.warning_once("Allowing insecure serialization using pickle due to "
45 + "VLLM_ALLOW_INSECURE_SERIALIZATION=1")
46 +
47 +
48 class MsgpackEncoder:
49 """Encoder with custom torch tensor and numpy array serialization.
50
@@ -60,9 +65,7 @@ class MsgpackEncoder:
65 self.aux_buffers: Optional[list[bytestr]] = None
66 self.size_threshold = size_threshold
67 if envs.VLLM_ALLOW_INSECURE_SERIALIZATION:
63 - logger.warning(
64 - "Allowing insecure serialization using pickle due to "
65 - "VLLM_ALLOW_INSECURE_SERIALIZATION=1")
68 + _log_insecure_serialization_warning()
69
70 def encode(self, obj: Any) -> Sequence[bytestr]:
71 try:
@@ -119,7 +122,9 @@ class MsgpackEncoder:
122 for item in itemlist]
123
124 if not envs.VLLM_ALLOW_INSECURE_SERIALIZATION:
122 - raise TypeError(f"Object of type {type(obj)} is not serializable")
125 + raise TypeError(f"Object of type {type(obj)} is not serializable"
126 + "Set VLLM_ALLOW_INSECURE_SERIALIZATION=1 to allow "
127 + "fallback to pickle-based serialization.")
128
129 if isinstance(obj, FunctionType):
130 # `pickle` is generally faster than cloudpickle, but can have
@@ -202,9 +207,7 @@ class MsgpackDecoder:
207 dec_hook=self.dec_hook)
208 self.aux_buffers: Sequence[bytestr] = ()
209 if envs.VLLM_ALLOW_INSECURE_SERIALIZATION:
205 - logger.warning(
206 - "Allowing insecure deserialization using pickle due to "
207 - "VLLM_ALLOW_INSECURE_SERIALIZATION=1")
210 + _log_insecure_serialization_warning()
211
212 def decode(self, bufs: Union[bytestr, Sequence[bytestr]]) -> Any:
213 if isinstance(bufs, (bytes, bytearray, memoryview, zmq.Frame)):