Support Python 3.10 runtime compatibility (#5366)

Signed-off-by: Xiaodong Ye <xiaodong.ye@mthreads.com>
This commit is contained in:
R0CKSTAR authored and GitHub committed 2026-07-29 17:11:04 +08:00
1 parent 18be2ba3df
commit 7be7e0d249
6 files changed
+38 -71

No files matched your search

+10 -10
View File
@@ -10,7 +10,7 @@ import multiprocessing
import time
import traceback
from collections.abc import Iterable, Sequence
from enum import StrEnum, auto
from enum import Enum
from types import SimpleNamespace
from typing import Any, NamedTuple
@@ -57,15 +57,15 @@ class SamplingCase(NamedTuple):
lora: dict | None = None
class SamplingKind(StrEnum):
IMAGE_NONE = auto()
IMAGE_DIFFUSION_SINGLE = auto()
UNDERSTANDING_NONE = auto()
UNDERSTANDING_AR_LIST = auto()
TTS_NONE = auto()
TTS_DIFFUSION_SINGLE = auto()
VIDEO_NONE = auto()
VIDEO_DIFFUSION_SINGLE = auto()
class SamplingKind(str, Enum):
IMAGE_NONE = "image_none"
IMAGE_DIFFUSION_SINGLE = "image_diffusion_single"
UNDERSTANDING_NONE = "understanding_none"
UNDERSTANDING_AR_LIST = "understanding_ar_list"
TTS_NONE = "tts_none"
TTS_DIFFUSION_SINGLE = "tts_diffusion_single"
VIDEO_NONE = "video_none"
VIDEO_DIFFUSION_SINGLE = "video_diffusion_single"
# Pre-defined arguments to be used in function calls during the tests
@@ -16,20 +16,10 @@ Key invariants tested:
- voice/speaker parameter compatibility in chat completions
"""
import enum
import json
from unittest.mock import MagicMock
import pytest
# Python 3.10 compat: StrEnum was added in 3.11
if not hasattr(enum, "StrEnum"):
class _StrEnum(str, enum.Enum):
"""Minimal StrEnum backport for Python 3.10."""
enum.StrEnum = _StrEnum # type: ignore[attr-defined]
from vllm.entrypoints.openai.chat_completion.protocol import (
ChatCompletionRequest,
ChatCompletionResponseStreamChoice,
+15 -15
View File
@@ -3,7 +3,7 @@ Common definitions for controlling what tests run where.
"""
from collections.abc import Callable
from enum import StrEnum, auto
from enum import Enum
from typing import NamedTuple, TypeAlias
from pytest import MarkDecorator
@@ -15,26 +15,26 @@ from vllm_omni.entrypoints.omni import Omni
TinyDiffusionBuilder: TypeAlias = Callable[[], str]
class DiffusionAccs(StrEnum):
class DiffusionAccs(str, Enum):
"""Supported acceleration types / test settings for Diffusion Models."""
HSDP = auto()
TEA_CACHE = auto()
CACHE_DIT = auto()
SEQUENCE_PARALLEL = auto()
CFG_PARALLEL = auto()
TENSOR_PARALLEL = auto()
CPU_OFFLOAD = auto()
LAYERWISE_OFFLOAD = auto()
VAE_PATCH_PARALLEL = auto()
HSDP = "hsdp"
TEA_CACHE = "tea_cache"
CACHE_DIT = "cache_dit"
SEQUENCE_PARALLEL = "sequence_parallel"
CFG_PARALLEL = "cfg_parallel"
TENSOR_PARALLEL = "tensor_parallel"
CPU_OFFLOAD = "cpu_offload"
LAYERWISE_OFFLOAD = "layerwise_offload"
VAE_PATCH_PARALLEL = "vae_patch_parallel"
class DiffusionTasks(StrEnum):
class DiffusionTasks(str, Enum):
"""Supported tasks for Diffusion Models."""
TEXT_TO_IMAGE = auto()
IMAGE_TO_IMAGE = auto()
TEXT_TO_VIDEO = auto()
TEXT_TO_IMAGE = "text_to_image"
IMAGE_TO_IMAGE = "image_to_image"
TEXT_TO_VIDEO = "text_to_video"
# Text to audio, etc should be added here as needed