update pre-commit config (#18860)

This commit is contained in:
SoluMilken
2026-02-16 00:18:31 +08:00
committed by GitHub
parent f7603203b0
commit 07a24f1a38
135 changed files with 239 additions and 198 deletions
@@ -243,12 +243,10 @@ def run_sgl_diffusion_webui(server_args: ServerArgs):
# print banner
delimiter = "=" * 80
url = local_url or f"http://localhost:{server_args.webui_port}"
print(
f"""
print(f"""
{delimiter}
\033[1mSGLang Diffusion WebUI available at:\033[0m \033[1;4;92m{url}\033[0m
{delimiter}
"""
)
""")
demo.block_thread()
@@ -1,5 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
"""Qwen3 text encoder configuration for SGLang diffusion models."""
from dataclasses import dataclass, field
from sglang.multimodal_gen.configs.models.encoders.base import (
@@ -9,6 +9,7 @@ diffusion transformer (DiT) inference:
- cache-dit integration: Block-level caching with DBCache and TaylorSeer
"""
from sglang.multimodal_gen.runtime.cache.cache_dit_integration import (
CacheDitConfig,
enable_cache_on_dual_transformer,
@@ -29,6 +29,7 @@ The typical workflow is:
If you only need to use the distributed environment without model parallelism,
you can skip the model parallel initialization and destruction steps.
"""
import contextlib
import datetime
import os
@@ -71,7 +72,7 @@ TensorMetadata = namedtuple("TensorMetadata", ["device", "dtype", "size"])
def _split_tensor_dict(
tensor_dict: dict[str, torch.Tensor | Any]
tensor_dict: dict[str, torch.Tensor | Any],
) -> tuple[list[tuple[str, Any]], list[torch.Tensor]]:
"""Split the tensor dictionary into two parts:
1. A list of (key, value) pairs. If the value is a tensor, it is replaced
@@ -3,6 +3,7 @@
# SPDX-License-Identifier: Apache-2.0
# Adapted from vllm: https://github.com/vllm-project/vllm/blob/v0.7.3/vllm/model_executor/layers/activation.py
"""Custom activation functions."""
import math
from typing import Any
@@ -3,6 +3,7 @@
# SPDX-License-Identifier: Apache-2.0
# Adapted from vllm: https://github.com/vllm-project/vllm/blob/v0.7.3/vllm/model_executor/layers/layernorm.py
"""Custom normalization layers."""
from typing import Optional, Tuple, Union
import torch
@@ -25,6 +25,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Rotary Positional Embeddings."""
import functools
from collections import OrderedDict
from typing import Any, Optional, Tuple
@@ -3,6 +3,7 @@
# SPDX-License-Identifier: Apache-2.0
# Adapted from vllm: https://github.com/vllm-project/vllm/blob/v0.7.3/vllm/model_executor/layers/utils.py
"""Utility methods for model layers."""
import inspect
from typing import Any, Callable, List, Optional
@@ -12,7 +12,10 @@ from diffusers.models.embeddings import (
from diffusers.models.embeddings import (
CombinedTimestepTextProjEmbeddings as _CombinedTimestepTextProjEmbeddings,
)
from diffusers.models.embeddings import PixArtAlphaTextProjection, TimestepEmbedding
from diffusers.models.embeddings import (
PixArtAlphaTextProjection,
TimestepEmbedding,
)
from diffusers.models.embeddings import Timesteps as _Timesteps
from diffusers.models.embeddings import (
get_timestep_embedding as timestep_embedding_diffusers,
@@ -2,6 +2,7 @@
# SPDX-License-Identifier: Apache-2.0
"""Utilities for selecting and loading models."""
import contextlib
import glob
import os
@@ -30,7 +31,7 @@ def set_default_torch_dtype(dtype: torch.dtype):
def get_param_names_mapping(
mapping_dict: dict[str, str]
mapping_dict: dict[str, str],
) -> Callable[[str], tuple[str, Any, Any]]:
"""
Creates a mapping function that transforms parameter names using regex patterns.
@@ -3,6 +3,7 @@
# SPDX-License-Identifier: Apache-2.0
# Adapted from vllm: https://github.com/vllm-project/vllm/blob/v0.7.3/vllm/model_executor/model_loader/weight_utils.py
"""Utilities for downloading and initializing model weights."""
import hashlib
import json
import os
@@ -5,6 +5,7 @@
# Adapted from transformers: https://github.com/huggingface/transformers/blob/v4.39.0/src/transformers/models/clip/modeling_clip.py
"""Minimal implementation of CLIPVisionModel intended to be only used
within a vision language model."""
from collections.abc import Iterable
from typing import Optional
@@ -25,6 +25,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Inference-only LLaMA model compatible with HuggingFace weights."""
from collections.abc import Iterable
from typing import Any
@@ -3,6 +3,7 @@
# SPDX-License-Identifier: Apache-2.0
# Adapted from: https://github.com/vllm-project/vllm/blob/v0.7.3/vllm/model_executor/utils.py
"""Utils for model executor."""
from typing import Any
import torch
@@ -8,7 +8,6 @@ This module contains an implementation of the Hunyuan video diffusion pipeline
using the modular pipeline architecture.
"""
from sglang.multimodal_gen.runtime.pipelines_core.composed_pipeline_base import (
ComposedPipelineBase,
)
@@ -4,6 +4,7 @@
"""
Synchronous pipeline executor implementation.
"""
from typing import List
from sglang.multimodal_gen.runtime.pipelines_core.executors.pipeline_executor import (
@@ -5,6 +5,7 @@ This stage extends LatentPreparationStage to handle device mismatch issues
that occur when tensors are pickled and unpickled via broadcast_pyobj in
multi-GPU scenarios.
"""
import dataclasses
import torch
@@ -4,6 +4,7 @@
"""
Input validation stage for diffusion pipelines.
"""
import numpy as np
import torch
import torchvision.transforms.functional as TF
@@ -4,6 +4,7 @@
"""
Latent preparation stage for diffusion pipelines.
"""
from diffusers.utils.torch_utils import randn_tensor
from sglang.multimodal_gen.runtime.distributed import get_local_torch_device
@@ -6,6 +6,7 @@
This file is a platform abstraction for ROCm GPUs,
adjusted to match the structure and interface of `cuda.py`.
"""
from functools import lru_cache
from typing import Any
@@ -3,6 +3,7 @@
# SPDX-License-Identifier: Apache-2.0
# Inspired by SGLang: https://github.com/sgl-project/sglang/blob/main/python/sglang/srt/server_args.py
"""The arguments of sglang-diffusion Inference."""
import argparse
import dataclasses
import inspect
@@ -3,6 +3,7 @@
# SPDX-License-Identifier: Apache-2.0
# adapted from vllm: https://github.com/vllm-project/vllm/blob/v0.7.3/vllm/logger.py
"""Logging configuration for sglang.multimodal_gen."""
import argparse
import contextlib
import datetime
@@ -1,8 +1,9 @@
# Copied and adapted from: https://github.com/hao-ai-lab/FastVideo
"""
Common generate cli test, one test for image and video each
Common generate cli test, one test for image and video each
"""
import dataclasses
import os
import shlex
@@ -1,5 +1,5 @@
"""
This file upload the media generated in diffusion-nightly-test to a slack channel of SGLang
This file upload the media generated in diffusion-nightly-test to a slack channel of SGLang
"""
import logging
+2 -2
View File
@@ -4855,7 +4855,7 @@ def nvmlDeviceGetFieldValues(handle, fieldIds):
for i, fieldId in enumerate(fieldIds):
try:
(values[i].fieldId, values[i].scopeId) = fieldId
values[i].fieldId, values[i].scopeId = fieldId
except TypeError:
values[i].fieldId = fieldId
@@ -4871,7 +4871,7 @@ def nvmlDeviceClearFieldValues(handle, fieldIds):
for i, fieldId in enumerate(fieldIds):
try:
(values[i].fieldId, values[i].scopeId) = fieldId
values[i].fieldId, values[i].scopeId = fieldId
except TypeError:
values[i].fieldId = fieldId