mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2025-12-10 09:01:40 +08:00
Support FIPS enabled machines with MD5 hashing (#15299)
Signed-off-by: Matthew Vine <32849887+MattTheCuber@users.noreply.github.com>
This commit is contained in:
parent
e74ff409e0
commit
7a6d45bc8a
@ -63,7 +63,8 @@ class LlamaConfig:
|
|||||||
factors.append((k, v))
|
factors.append((k, v))
|
||||||
factors.sort()
|
factors.sort()
|
||||||
import hashlib
|
import hashlib
|
||||||
return hashlib.md5(str(factors).encode()).hexdigest()
|
return hashlib.md5(str(factors).encode(),
|
||||||
|
usedforsecurity=False).hexdigest()
|
||||||
|
|
||||||
def __post_init__(self):
|
def __post_init__(self):
|
||||||
assert self.mlp_size >= self.hidden_size
|
assert self.mlp_size >= self.hidden_size
|
||||||
|
|||||||
@ -381,8 +381,8 @@ class VllmBackend:
|
|||||||
with open(filepath) as f:
|
with open(filepath) as f:
|
||||||
hash_content.append(f.read())
|
hash_content.append(f.read())
|
||||||
import hashlib
|
import hashlib
|
||||||
code_hash = hashlib.md5(
|
code_hash = hashlib.md5("\n".join(hash_content).encode(),
|
||||||
"\n".join(hash_content).encode()).hexdigest()
|
usedforsecurity=False).hexdigest()
|
||||||
factors.append(code_hash)
|
factors.append(code_hash)
|
||||||
|
|
||||||
# 3. compiler hash
|
# 3. compiler hash
|
||||||
@ -390,7 +390,8 @@ class VllmBackend:
|
|||||||
factors.append(compiler_hash)
|
factors.append(compiler_hash)
|
||||||
|
|
||||||
# combine all factors to generate the cache dir
|
# combine all factors to generate the cache dir
|
||||||
hash_key = hashlib.md5(str(factors).encode()).hexdigest()[:10]
|
hash_key = hashlib.md5(str(factors).encode(),
|
||||||
|
usedforsecurity=False).hexdigest()[:10]
|
||||||
|
|
||||||
cache_dir = os.path.join(
|
cache_dir = os.path.join(
|
||||||
envs.VLLM_CACHE_ROOT,
|
envs.VLLM_CACHE_ROOT,
|
||||||
|
|||||||
@ -139,7 +139,8 @@ class InductorAdaptor(CompilerInterface):
|
|||||||
from torch._inductor.codecache import torch_key
|
from torch._inductor.codecache import torch_key
|
||||||
torch_factors = torch_key()
|
torch_factors = torch_key()
|
||||||
factors.append(torch_factors)
|
factors.append(torch_factors)
|
||||||
hash_str = hashlib.md5(str(factors).encode()).hexdigest()[:10]
|
hash_str = hashlib.md5(str(factors).encode(),
|
||||||
|
usedforsecurity=False).hexdigest()[:10]
|
||||||
return hash_str
|
return hash_str
|
||||||
|
|
||||||
def initialize_cache(self, cache_dir: str, disable_cache: bool = False):
|
def initialize_cache(self, cache_dir: str, disable_cache: bool = False):
|
||||||
|
|||||||
@ -1111,7 +1111,8 @@ class CacheConfig:
|
|||||||
factors: list[Any] = []
|
factors: list[Any] = []
|
||||||
factors.append(self.cache_dtype)
|
factors.append(self.cache_dtype)
|
||||||
# `cpu_offload_gb` does not use `torch.compile` yet.
|
# `cpu_offload_gb` does not use `torch.compile` yet.
|
||||||
hash_str = hashlib.md5(str(factors).encode()).hexdigest()
|
hash_str = hashlib.md5(str(factors).encode(),
|
||||||
|
usedforsecurity=False).hexdigest()
|
||||||
return hash_str
|
return hash_str
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
@ -1243,7 +1244,8 @@ class TokenizerPoolConfig:
|
|||||||
# no factors to consider.
|
# no factors to consider.
|
||||||
# this config will not affect the computation graph.
|
# this config will not affect the computation graph.
|
||||||
factors: list[Any] = []
|
factors: list[Any] = []
|
||||||
hash_str = hashlib.md5(str(factors).encode()).hexdigest()
|
hash_str = hashlib.md5(str(factors).encode(),
|
||||||
|
usedforsecurity=False).hexdigest()
|
||||||
return hash_str
|
return hash_str
|
||||||
|
|
||||||
def __post_init__(self):
|
def __post_init__(self):
|
||||||
@ -1354,7 +1356,8 @@ class LoadConfig:
|
|||||||
# no factors to consider.
|
# no factors to consider.
|
||||||
# this config will not affect the computation graph.
|
# this config will not affect the computation graph.
|
||||||
factors: list[Any] = []
|
factors: list[Any] = []
|
||||||
hash_str = hashlib.md5(str(factors).encode()).hexdigest()
|
hash_str = hashlib.md5(str(factors).encode(),
|
||||||
|
usedforsecurity=False).hexdigest()
|
||||||
return hash_str
|
return hash_str
|
||||||
|
|
||||||
def __post_init__(self):
|
def __post_init__(self):
|
||||||
@ -1674,7 +1677,8 @@ class SchedulerConfig:
|
|||||||
# no factors to consider.
|
# no factors to consider.
|
||||||
# this config will not affect the computation graph.
|
# this config will not affect the computation graph.
|
||||||
factors: list[Any] = []
|
factors: list[Any] = []
|
||||||
hash_str = hashlib.md5(str(factors).encode()).hexdigest()
|
hash_str = hashlib.md5(str(factors).encode(),
|
||||||
|
usedforsecurity=False).hexdigest()
|
||||||
return hash_str
|
return hash_str
|
||||||
|
|
||||||
def __post_init__(self) -> None:
|
def __post_init__(self) -> None:
|
||||||
@ -1810,7 +1814,8 @@ class DeviceConfig:
|
|||||||
# the device/platform information will be summarized
|
# the device/platform information will be summarized
|
||||||
# by torch/vllm automatically.
|
# by torch/vllm automatically.
|
||||||
factors: list[Any] = []
|
factors: list[Any] = []
|
||||||
hash_str = hashlib.md5(str(factors).encode()).hexdigest()
|
hash_str = hashlib.md5(str(factors).encode(),
|
||||||
|
usedforsecurity=False).hexdigest()
|
||||||
return hash_str
|
return hash_str
|
||||||
|
|
||||||
def __init__(self, device: str = "auto") -> None:
|
def __init__(self, device: str = "auto") -> None:
|
||||||
@ -1983,7 +1988,8 @@ class SpeculativeConfig:
|
|||||||
# no factors to consider.
|
# no factors to consider.
|
||||||
# spec decode does not use `torch.compile` yet.
|
# spec decode does not use `torch.compile` yet.
|
||||||
factors: list[Any] = []
|
factors: list[Any] = []
|
||||||
hash_str = hashlib.md5(str(factors).encode()).hexdigest()
|
hash_str = hashlib.md5(str(factors).encode(),
|
||||||
|
usedforsecurity=False).hexdigest()
|
||||||
return hash_str
|
return hash_str
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -2358,7 +2364,8 @@ class LoRAConfig:
|
|||||||
factors.append(self.lora_extra_vocab_size)
|
factors.append(self.lora_extra_vocab_size)
|
||||||
factors.append(self.long_lora_scaling_factors)
|
factors.append(self.long_lora_scaling_factors)
|
||||||
factors.append(self.bias_enabled)
|
factors.append(self.bias_enabled)
|
||||||
hash_str = hashlib.md5(str(factors).encode()).hexdigest()
|
hash_str = hashlib.md5(str(factors).encode(),
|
||||||
|
usedforsecurity=False).hexdigest()
|
||||||
return hash_str
|
return hash_str
|
||||||
|
|
||||||
def __post_init__(self):
|
def __post_init__(self):
|
||||||
@ -2424,7 +2431,8 @@ class PromptAdapterConfig:
|
|||||||
# no factors to consider.
|
# no factors to consider.
|
||||||
# this config will not affect the computation graph.
|
# this config will not affect the computation graph.
|
||||||
factors: list[Any] = []
|
factors: list[Any] = []
|
||||||
hash_str = hashlib.md5(str(factors).encode()).hexdigest()
|
hash_str = hashlib.md5(str(factors).encode(),
|
||||||
|
usedforsecurity=False).hexdigest()
|
||||||
return hash_str
|
return hash_str
|
||||||
|
|
||||||
def __post_init__(self):
|
def __post_init__(self):
|
||||||
@ -2469,7 +2477,8 @@ class MultiModalConfig:
|
|||||||
# no factors to consider.
|
# no factors to consider.
|
||||||
# this config will not affect the computation graph.
|
# this config will not affect the computation graph.
|
||||||
factors: list[Any] = []
|
factors: list[Any] = []
|
||||||
hash_str = hashlib.md5(str(factors).encode()).hexdigest()
|
hash_str = hashlib.md5(str(factors).encode(),
|
||||||
|
usedforsecurity=False).hexdigest()
|
||||||
return hash_str
|
return hash_str
|
||||||
|
|
||||||
def get_limit_per_prompt(self, modality: str) -> int:
|
def get_limit_per_prompt(self, modality: str) -> int:
|
||||||
@ -2535,7 +2544,8 @@ class PoolerConfig:
|
|||||||
# no factors to consider.
|
# no factors to consider.
|
||||||
# this config will not affect the computation graph.
|
# this config will not affect the computation graph.
|
||||||
factors: list[Any] = []
|
factors: list[Any] = []
|
||||||
hash_str = hashlib.md5(str(factors).encode()).hexdigest()
|
hash_str = hashlib.md5(str(factors).encode(),
|
||||||
|
usedforsecurity=False).hexdigest()
|
||||||
return hash_str
|
return hash_str
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@ -2816,7 +2826,8 @@ class DecodingConfig:
|
|||||||
# no factors to consider.
|
# no factors to consider.
|
||||||
# this config will not affect the computation graph.
|
# this config will not affect the computation graph.
|
||||||
factors: list[Any] = []
|
factors: list[Any] = []
|
||||||
hash_str = hashlib.md5(str(factors).encode()).hexdigest()
|
hash_str = hashlib.md5(str(factors).encode(),
|
||||||
|
usedforsecurity=False).hexdigest()
|
||||||
return hash_str
|
return hash_str
|
||||||
|
|
||||||
def __post_init__(self):
|
def __post_init__(self):
|
||||||
@ -2866,7 +2877,8 @@ class ObservabilityConfig:
|
|||||||
# no factors to consider.
|
# no factors to consider.
|
||||||
# this config will not affect the computation graph.
|
# this config will not affect the computation graph.
|
||||||
factors: list[Any] = []
|
factors: list[Any] = []
|
||||||
hash_str = hashlib.md5(str(factors).encode()).hexdigest()
|
hash_str = hashlib.md5(str(factors).encode(),
|
||||||
|
usedforsecurity=False).hexdigest()
|
||||||
return hash_str
|
return hash_str
|
||||||
|
|
||||||
def __post_init__(self):
|
def __post_init__(self):
|
||||||
@ -2928,7 +2940,8 @@ class KVTransferConfig(BaseModel):
|
|||||||
# no factors to consider.
|
# no factors to consider.
|
||||||
# this config will not affect the computation graph.
|
# this config will not affect the computation graph.
|
||||||
factors: list[Any] = []
|
factors: list[Any] = []
|
||||||
hash_str = hashlib.md5(str(factors).encode()).hexdigest()
|
hash_str = hashlib.md5(str(factors).encode(),
|
||||||
|
usedforsecurity=False).hexdigest()
|
||||||
return hash_str
|
return hash_str
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -3425,7 +3438,8 @@ class VllmConfig:
|
|||||||
vllm_factors.append("None")
|
vllm_factors.append("None")
|
||||||
factors.append(vllm_factors)
|
factors.append(vllm_factors)
|
||||||
|
|
||||||
hash_str = hashlib.md5(str(factors).encode()).hexdigest()[:10]
|
hash_str = hashlib.md5(str(factors).encode(),
|
||||||
|
usedforsecurity=False).hexdigest()[:10]
|
||||||
return hash_str
|
return hash_str
|
||||||
|
|
||||||
def pad_for_cudagraph(self, batch_size: int) -> int:
|
def pad_for_cudagraph(self, batch_size: int) -> int:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user