CI: Kill zombie diffusion processes in CI & minor code style fix on rotary embedding fallback (#13637)
This commit is contained in:
@@ -62,7 +62,7 @@ class GPUWorker:
|
|||||||
|
|
||||||
def init_device_and_model(self) -> None:
|
def init_device_and_model(self) -> None:
|
||||||
"""Initialize the device and load the model."""
|
"""Initialize the device and load the model."""
|
||||||
setproctitle(f"sgl_diffusion::scheduler:{self.local_rank}")
|
setproctitle(f"sgl_diffusion::scheduler_TP{self.local_rank}")
|
||||||
torch.cuda.set_device(self.local_rank)
|
torch.cuda.set_device(self.local_rank)
|
||||||
# Set environment variables for distributed initialization
|
# Set environment variables for distributed initialization
|
||||||
os.environ["MASTER_ADDR"] = "localhost"
|
os.environ["MASTER_ADDR"] = "localhost"
|
||||||
|
|||||||
@@ -120,7 +120,10 @@ class RotaryEmbedding(CustomOp):
|
|||||||
):
|
):
|
||||||
from vllm._custom_ops import rotary_embedding
|
from vllm._custom_ops import rotary_embedding
|
||||||
|
|
||||||
self.vllm_rotary_embedding = rotary_embedding
|
self.use_fallback_kernel = True
|
||||||
|
self.fallback_rotary_embedding = rotary_embedding
|
||||||
|
else:
|
||||||
|
self.use_fallback_kernel = False
|
||||||
|
|
||||||
self.cos_sin_cache: torch.Tensor
|
self.cos_sin_cache: torch.Tensor
|
||||||
self.register_buffer("cos_sin_cache", cache, persistent=False)
|
self.register_buffer("cos_sin_cache", cache, persistent=False)
|
||||||
@@ -273,7 +276,7 @@ class RotaryEmbedding(CustomOp):
|
|||||||
offsets: Optional[torch.Tensor] = None,
|
offsets: Optional[torch.Tensor] = None,
|
||||||
fused_set_kv_buffer_arg: Optional[FusedSetKVBufferArg] = None,
|
fused_set_kv_buffer_arg: Optional[FusedSetKVBufferArg] = None,
|
||||||
) -> Tuple[torch.Tensor, torch.Tensor]:
|
) -> Tuple[torch.Tensor, torch.Tensor]:
|
||||||
if _is_cuda and (self.head_size in [64, 128, 256, 512]):
|
if not self.use_fallback_kernel:
|
||||||
apply_rope_with_cos_sin_cache_inplace(
|
apply_rope_with_cos_sin_cache_inplace(
|
||||||
positions=positions,
|
positions=positions,
|
||||||
query=query,
|
query=query,
|
||||||
@@ -293,7 +296,7 @@ class RotaryEmbedding(CustomOp):
|
|||||||
fused_set_kv_buffer_arg is None
|
fused_set_kv_buffer_arg is None
|
||||||
), "save kv cache is not supported for vllm_rotary_embedding."
|
), "save kv cache is not supported for vllm_rotary_embedding."
|
||||||
self.cos_sin_cache = self.cos_sin_cache.to(query.device, dtype=query.dtype)
|
self.cos_sin_cache = self.cos_sin_cache.to(query.device, dtype=query.dtype)
|
||||||
self.vllm_rotary_embedding(
|
self.fallback_rotary_embedding(
|
||||||
positions,
|
positions,
|
||||||
query,
|
query,
|
||||||
key,
|
key,
|
||||||
|
|||||||
@@ -473,11 +473,13 @@ class VocabParallelEmbedding(torch.nn.Module):
|
|||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
masked_input = input_
|
masked_input = input_
|
||||||
|
|
||||||
# Get the embeddings.
|
# Get the embeddings.
|
||||||
with use_symmetric_memory(get_tp_group(), disabled=not self.enable_tp):
|
with use_symmetric_memory(get_tp_group(), disabled=not self.enable_tp):
|
||||||
output_parallel = self.quant_method.embedding(self, masked_input.long())
|
output_parallel = self.quant_method.embedding(self, masked_input.long())
|
||||||
# Mask the output embedding.
|
|
||||||
if self.tp_size > 1:
|
if self.tp_size > 1:
|
||||||
|
# Mask the output embedding.
|
||||||
output_parallel.masked_fill_(input_mask.unsqueeze(-1), 0)
|
output_parallel.masked_fill_(input_mask.unsqueeze(-1), 0)
|
||||||
if not get_attn_tp_context().input_scattered:
|
if not get_attn_tp_context().input_scattered:
|
||||||
# Reduce across all the model parallel GPUs.
|
# Reduce across all the model parallel GPUs.
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
from typing import Optional
|
||||||
|
|
||||||
|
_PRIORITY_MIN = 0
|
||||||
|
_PRIORITY_MAX = 31
|
||||||
|
_LOW_PRIORITY_VALUE = "LOW"
|
||||||
|
_HIGH_PRIORITY_VALUE = "HIGH"
|
||||||
|
|
||||||
|
UNKNOWN_PRIORITY_VALUE = "UNKNOWN"
|
||||||
|
|
||||||
|
|
||||||
|
def transform_priority(priority: Optional[int]) -> str:
|
||||||
|
"""Transform the priority to a string for metrics reporting.
|
||||||
|
Limit the range to prevent high cardinality issues.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
priority: The priority to transform.
|
||||||
|
Returns:
|
||||||
|
The transformed priority.
|
||||||
|
"""
|
||||||
|
if priority is None:
|
||||||
|
return UNKNOWN_PRIORITY_VALUE
|
||||||
|
elif priority < _PRIORITY_MIN:
|
||||||
|
return _LOW_PRIORITY_VALUE
|
||||||
|
elif priority >= _PRIORITY_MAX:
|
||||||
|
return _HIGH_PRIORITY_VALUE
|
||||||
|
else:
|
||||||
|
return str(priority)
|
||||||
@@ -4,14 +4,14 @@ if [ "$1" = "rocm" ]; then
|
|||||||
echo "Running in ROCm mode"
|
echo "Running in ROCm mode"
|
||||||
|
|
||||||
# Clean SGLang processes
|
# Clean SGLang processes
|
||||||
pgrep -f 'sglang::|sglang\.launch_server|sglang\.bench|sglang\.data_parallel|sglang\.srt' | xargs -r kill -9
|
pgrep -f 'sglang::|sglang\.launch_server|sglang\.bench|sglang\.data_parallel|sglang\.srt|sgl_diffusion::' | xargs -r kill -9
|
||||||
|
|
||||||
else
|
else
|
||||||
# Show current GPU status
|
# Show current GPU status
|
||||||
nvidia-smi
|
nvidia-smi
|
||||||
|
|
||||||
# Clean SGLang processes
|
# Clean SGLang processes
|
||||||
pgrep -f 'sglang::|sglang\.launch_server|sglang\.bench|sglang\.data_parallel|sglang\.srt' | xargs -r kill -9
|
pgrep -f 'sglang::|sglang\.launch_server|sglang\.bench|sglang\.data_parallel|sglang\.srt|sgl_diffusion::' | xargs -r kill -9
|
||||||
|
|
||||||
# Clean all GPU processes if any argument is provided
|
# Clean all GPU processes if any argument is provided
|
||||||
if [ $# -gt 0 ]; then
|
if [ $# -gt 0 ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user