[AMD][Diffusion] support timestep embedding kernel for AMD GPUs (#16766)
This commit is contained in:
@@ -14,11 +14,16 @@ from diffusers.models.embeddings import (
|
||||
)
|
||||
from diffusers.models.embeddings import PixArtAlphaTextProjection, TimestepEmbedding
|
||||
from diffusers.models.embeddings import Timesteps as _Timesteps
|
||||
from diffusers.models.embeddings import (
|
||||
get_timestep_embedding as _get_timestep_embedding,
|
||||
)
|
||||
|
||||
try:
|
||||
from sgl_kernel.elementwise import timestep_embedding as timestep_embedding_cuda
|
||||
except Exception as _e:
|
||||
pass
|
||||
# Fallback to diffusers implementation so downstream code can still run
|
||||
# even if `sgl_kernel` is not installed/available.
|
||||
timestep_embedding_cuda = _get_timestep_embedding
|
||||
|
||||
from sglang.multimodal_gen.runtime.layers.activation import get_act_fn
|
||||
from sglang.multimodal_gen.runtime.layers.linear import ColumnParallelLinear
|
||||
|
||||
@@ -19,10 +19,6 @@ from typing import Any, Dict, List, Optional, Tuple, Union
|
||||
import torch
|
||||
import torch.nn as nn
|
||||
from diffusers.models.attention import AttentionModuleMixin, FeedForward
|
||||
from diffusers.models.embeddings import (
|
||||
CombinedTimestepGuidanceTextProjEmbeddings,
|
||||
CombinedTimestepTextProjEmbeddings,
|
||||
)
|
||||
from diffusers.models.modeling_outputs import Transformer2DModelOutput
|
||||
from diffusers.models.normalization import (
|
||||
AdaLayerNormContinuous,
|
||||
@@ -42,6 +38,10 @@ from sglang.multimodal_gen.runtime.layers.rotary_embedding import (
|
||||
NDRotaryEmbedding,
|
||||
apply_flashinfer_rope_qk_inplace,
|
||||
)
|
||||
from sglang.multimodal_gen.runtime.layers.visual_embedding import (
|
||||
CombinedTimestepGuidanceTextProjEmbeddings,
|
||||
CombinedTimestepTextProjEmbeddings,
|
||||
)
|
||||
from sglang.multimodal_gen.runtime.models.dits.base import CachableDiT
|
||||
from sglang.multimodal_gen.runtime.platforms import current_platform
|
||||
from sglang.multimodal_gen.runtime.utils.layerwise_offload import OffloadableDiTMixin
|
||||
|
||||
Reference in New Issue
Block a user