little change

This commit is contained in:
songkey-win
2025-06-09 11:22:53 +08:00
parent ce368e562f
commit 75a420a028
2 changed files with 14 additions and 6 deletions
+13 -5
View File
@@ -18,7 +18,6 @@ from diffusers.models.attention import Attention, FeedForward
from diffusers.models.unets.unet_motion_model import AnimateDiffTransformer3D
from torchvision.models.resnet import BasicBlock
from diffusers.models.embeddings import (SinusoidalPositionalEmbedding,
get_1d_sincos_pos_embed_from_grid,
TimestepEmbedding)
from diffusers.utils import logging
@@ -315,10 +314,19 @@ class SmallUnetV5(nn.Module):
def get_posembed_linear(length, dim, dtype, device):
try:
return get_1d_sincos_pos_embed_from_grid(dim, torch.arange(length), output_type='pt').to(dtype=dtype, device=device)
except:
return get_1d_sincos_pos_embed_from_grid(dim, torch.arange(length)).to(dtype=dtype, device=device)
pos = torch.arange(length).float()
omega = torch.arange(dim // 2).float()
omega /= dim / 2.0
omega = 1.0 / 10000**omega # (D/2,)
pos = pos.reshape(-1) # (M,)
out = torch.outer(pos, omega) # (M, D/2), outer product
emb_sin = torch.sin(out) # (M, D/2)
emb_cos = torch.cos(out) # (M, D/2)
return torch.concat([emb_sin, emb_cos], dim=1).to(device=device, dtype=dtype) # (M, D)
class STKAttentionV5(nn.Module):
+1 -1
View File
@@ -1,7 +1,7 @@
[project]
name = "comfyui_hellomeme"
description = "This repository is the official implementation of the [a/HelloMeme](https://arxiv.org/pdf/2410.22901) ComfyUI interface"
version = "1.3.11"
version = "1.3.12"
license = {file = "LICENSE"}
[project.urls]