mirror of
https://github.com/modelscope/DiffSynth-Studio.git
synced 2026-03-18 22:08:13 +00:00
camera
This commit is contained in:
BIN
diffsynth/models/__pycache__/__init__.cpython-310.pyc
Normal file
BIN
diffsynth/models/__pycache__/__init__.cpython-310.pyc
Normal file
Binary file not shown.
BIN
diffsynth/models/__pycache__/attention.cpython-310.pyc
Normal file
BIN
diffsynth/models/__pycache__/attention.cpython-310.pyc
Normal file
Binary file not shown.
BIN
diffsynth/models/__pycache__/cog_dit.cpython-310.pyc
Normal file
BIN
diffsynth/models/__pycache__/cog_dit.cpython-310.pyc
Normal file
Binary file not shown.
BIN
diffsynth/models/__pycache__/cog_vae.cpython-310.pyc
Normal file
BIN
diffsynth/models/__pycache__/cog_vae.cpython-310.pyc
Normal file
Binary file not shown.
BIN
diffsynth/models/__pycache__/downloader.cpython-310.pyc
Normal file
BIN
diffsynth/models/__pycache__/downloader.cpython-310.pyc
Normal file
Binary file not shown.
BIN
diffsynth/models/__pycache__/flux_controlnet.cpython-310.pyc
Normal file
BIN
diffsynth/models/__pycache__/flux_controlnet.cpython-310.pyc
Normal file
Binary file not shown.
BIN
diffsynth/models/__pycache__/flux_dit.cpython-310.pyc
Normal file
BIN
diffsynth/models/__pycache__/flux_dit.cpython-310.pyc
Normal file
Binary file not shown.
BIN
diffsynth/models/__pycache__/flux_infiniteyou.cpython-310.pyc
Normal file
BIN
diffsynth/models/__pycache__/flux_infiniteyou.cpython-310.pyc
Normal file
Binary file not shown.
BIN
diffsynth/models/__pycache__/flux_ipadapter.cpython-310.pyc
Normal file
BIN
diffsynth/models/__pycache__/flux_ipadapter.cpython-310.pyc
Normal file
Binary file not shown.
BIN
diffsynth/models/__pycache__/flux_text_encoder.cpython-310.pyc
Normal file
BIN
diffsynth/models/__pycache__/flux_text_encoder.cpython-310.pyc
Normal file
Binary file not shown.
BIN
diffsynth/models/__pycache__/flux_vae.cpython-310.pyc
Normal file
BIN
diffsynth/models/__pycache__/flux_vae.cpython-310.pyc
Normal file
Binary file not shown.
BIN
diffsynth/models/__pycache__/hunyuan_dit.cpython-310.pyc
Normal file
BIN
diffsynth/models/__pycache__/hunyuan_dit.cpython-310.pyc
Normal file
Binary file not shown.
Binary file not shown.
BIN
diffsynth/models/__pycache__/hunyuan_video_dit.cpython-310.pyc
Normal file
BIN
diffsynth/models/__pycache__/hunyuan_video_dit.cpython-310.pyc
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
diffsynth/models/__pycache__/kolors_text_encoder.cpython-310.pyc
Normal file
BIN
diffsynth/models/__pycache__/kolors_text_encoder.cpython-310.pyc
Normal file
Binary file not shown.
BIN
diffsynth/models/__pycache__/lora.cpython-310.pyc
Normal file
BIN
diffsynth/models/__pycache__/lora.cpython-310.pyc
Normal file
Binary file not shown.
BIN
diffsynth/models/__pycache__/model_manager.cpython-310.pyc
Normal file
BIN
diffsynth/models/__pycache__/model_manager.cpython-310.pyc
Normal file
Binary file not shown.
BIN
diffsynth/models/__pycache__/omnigen.cpython-310.pyc
Normal file
BIN
diffsynth/models/__pycache__/omnigen.cpython-310.pyc
Normal file
Binary file not shown.
BIN
diffsynth/models/__pycache__/sd3_dit.cpython-310.pyc
Normal file
BIN
diffsynth/models/__pycache__/sd3_dit.cpython-310.pyc
Normal file
Binary file not shown.
BIN
diffsynth/models/__pycache__/sd3_text_encoder.cpython-310.pyc
Normal file
BIN
diffsynth/models/__pycache__/sd3_text_encoder.cpython-310.pyc
Normal file
Binary file not shown.
BIN
diffsynth/models/__pycache__/sd3_vae_decoder.cpython-310.pyc
Normal file
BIN
diffsynth/models/__pycache__/sd3_vae_decoder.cpython-310.pyc
Normal file
Binary file not shown.
BIN
diffsynth/models/__pycache__/sd3_vae_encoder.cpython-310.pyc
Normal file
BIN
diffsynth/models/__pycache__/sd3_vae_encoder.cpython-310.pyc
Normal file
Binary file not shown.
BIN
diffsynth/models/__pycache__/sd_controlnet.cpython-310.pyc
Normal file
BIN
diffsynth/models/__pycache__/sd_controlnet.cpython-310.pyc
Normal file
Binary file not shown.
BIN
diffsynth/models/__pycache__/sd_ipadapter.cpython-310.pyc
Normal file
BIN
diffsynth/models/__pycache__/sd_ipadapter.cpython-310.pyc
Normal file
Binary file not shown.
BIN
diffsynth/models/__pycache__/sd_motion.cpython-310.pyc
Normal file
BIN
diffsynth/models/__pycache__/sd_motion.cpython-310.pyc
Normal file
Binary file not shown.
BIN
diffsynth/models/__pycache__/sd_text_encoder.cpython-310.pyc
Normal file
BIN
diffsynth/models/__pycache__/sd_text_encoder.cpython-310.pyc
Normal file
Binary file not shown.
BIN
diffsynth/models/__pycache__/sd_unet.cpython-310.pyc
Normal file
BIN
diffsynth/models/__pycache__/sd_unet.cpython-310.pyc
Normal file
Binary file not shown.
BIN
diffsynth/models/__pycache__/sd_vae_decoder.cpython-310.pyc
Normal file
BIN
diffsynth/models/__pycache__/sd_vae_decoder.cpython-310.pyc
Normal file
Binary file not shown.
BIN
diffsynth/models/__pycache__/sd_vae_encoder.cpython-310.pyc
Normal file
BIN
diffsynth/models/__pycache__/sd_vae_encoder.cpython-310.pyc
Normal file
Binary file not shown.
BIN
diffsynth/models/__pycache__/sdxl_controlnet.cpython-310.pyc
Normal file
BIN
diffsynth/models/__pycache__/sdxl_controlnet.cpython-310.pyc
Normal file
Binary file not shown.
BIN
diffsynth/models/__pycache__/sdxl_ipadapter.cpython-310.pyc
Normal file
BIN
diffsynth/models/__pycache__/sdxl_ipadapter.cpython-310.pyc
Normal file
Binary file not shown.
BIN
diffsynth/models/__pycache__/sdxl_motion.cpython-310.pyc
Normal file
BIN
diffsynth/models/__pycache__/sdxl_motion.cpython-310.pyc
Normal file
Binary file not shown.
BIN
diffsynth/models/__pycache__/sdxl_text_encoder.cpython-310.pyc
Normal file
BIN
diffsynth/models/__pycache__/sdxl_text_encoder.cpython-310.pyc
Normal file
Binary file not shown.
BIN
diffsynth/models/__pycache__/sdxl_unet.cpython-310.pyc
Normal file
BIN
diffsynth/models/__pycache__/sdxl_unet.cpython-310.pyc
Normal file
Binary file not shown.
BIN
diffsynth/models/__pycache__/sdxl_vae_decoder.cpython-310.pyc
Normal file
BIN
diffsynth/models/__pycache__/sdxl_vae_decoder.cpython-310.pyc
Normal file
Binary file not shown.
BIN
diffsynth/models/__pycache__/sdxl_vae_encoder.cpython-310.pyc
Normal file
BIN
diffsynth/models/__pycache__/sdxl_vae_encoder.cpython-310.pyc
Normal file
Binary file not shown.
BIN
diffsynth/models/__pycache__/step1x_connector.cpython-310.pyc
Normal file
BIN
diffsynth/models/__pycache__/step1x_connector.cpython-310.pyc
Normal file
Binary file not shown.
BIN
diffsynth/models/__pycache__/stepvideo_dit.cpython-310.pyc
Normal file
BIN
diffsynth/models/__pycache__/stepvideo_dit.cpython-310.pyc
Normal file
Binary file not shown.
Binary file not shown.
BIN
diffsynth/models/__pycache__/stepvideo_vae.cpython-310.pyc
Normal file
BIN
diffsynth/models/__pycache__/stepvideo_vae.cpython-310.pyc
Normal file
Binary file not shown.
BIN
diffsynth/models/__pycache__/svd_image_encoder.cpython-310.pyc
Normal file
BIN
diffsynth/models/__pycache__/svd_image_encoder.cpython-310.pyc
Normal file
Binary file not shown.
BIN
diffsynth/models/__pycache__/svd_unet.cpython-310.pyc
Normal file
BIN
diffsynth/models/__pycache__/svd_unet.cpython-310.pyc
Normal file
Binary file not shown.
BIN
diffsynth/models/__pycache__/svd_vae_decoder.cpython-310.pyc
Normal file
BIN
diffsynth/models/__pycache__/svd_vae_decoder.cpython-310.pyc
Normal file
Binary file not shown.
BIN
diffsynth/models/__pycache__/svd_vae_encoder.cpython-310.pyc
Normal file
BIN
diffsynth/models/__pycache__/svd_vae_encoder.cpython-310.pyc
Normal file
Binary file not shown.
BIN
diffsynth/models/__pycache__/tiler.cpython-310.pyc
Normal file
BIN
diffsynth/models/__pycache__/tiler.cpython-310.pyc
Normal file
Binary file not shown.
BIN
diffsynth/models/__pycache__/utils.cpython-310.pyc
Normal file
BIN
diffsynth/models/__pycache__/utils.cpython-310.pyc
Normal file
Binary file not shown.
BIN
diffsynth/models/__pycache__/wan_video_dit.cpython-310.pyc
Normal file
BIN
diffsynth/models/__pycache__/wan_video_dit.cpython-310.pyc
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
diffsynth/models/__pycache__/wan_video_vace.cpython-310.pyc
Normal file
BIN
diffsynth/models/__pycache__/wan_video_vace.cpython-310.pyc
Normal file
Binary file not shown.
BIN
diffsynth/models/__pycache__/wan_video_vae.cpython-310.pyc
Normal file
BIN
diffsynth/models/__pycache__/wan_video_vae.cpython-310.pyc
Normal file
Binary file not shown.
@@ -5,6 +5,10 @@ import math
|
||||
from typing import Tuple, Optional
|
||||
from einops import rearrange
|
||||
from .utils import hash_state_dict_keys
|
||||
|
||||
from dchen.camera_adapter import SimpleAdapter
|
||||
|
||||
|
||||
try:
|
||||
import flash_attn_interface
|
||||
FLASH_ATTN_3_AVAILABLE = True
|
||||
@@ -273,6 +277,8 @@ class WanModel(torch.nn.Module):
|
||||
has_image_input: bool,
|
||||
has_image_pos_emb: bool = False,
|
||||
has_ref_conv: bool = False,
|
||||
add_control_adapter: bool = False,
|
||||
in_dim_control_adapter: int = 24,
|
||||
):
|
||||
super().__init__()
|
||||
self.dim = dim
|
||||
@@ -309,8 +315,17 @@ class WanModel(torch.nn.Module):
|
||||
self.has_image_pos_emb = has_image_pos_emb
|
||||
self.has_ref_conv = has_ref_conv
|
||||
|
||||
def patchify(self, x: torch.Tensor):
|
||||
if add_control_adapter:
|
||||
self.control_adapter = SimpleAdapter(in_dim_control_adapter, dim, kernel_size=patch_size[1:], stride=patch_size[1:])
|
||||
else:
|
||||
self.control_adapter = None
|
||||
|
||||
def patchify(self, x: torch.Tensor, control_camera_latents_input: torch.Tensor = None):
|
||||
x = self.patch_embedding(x)
|
||||
if self.control_adapter is not None and control_camera_latents_input is not None:
|
||||
y_camera = self.control_adapter(control_camera_latents_input)
|
||||
x = [u + v for u, v in zip(x, y_camera)]
|
||||
x = x[0].unsqueeze(0)
|
||||
grid_size = x.shape[2:]
|
||||
x = rearrange(x, 'b c f h w -> b (f h w) c').contiguous()
|
||||
return x, grid_size # x, grid_size: (f, h, w)
|
||||
@@ -612,6 +627,42 @@ class WanModelStateDictConverter:
|
||||
"eps": 1e-6,
|
||||
"has_ref_conv": True
|
||||
}
|
||||
elif hash_state_dict_keys(state_dict) == "ac6a5aa74f4a0aab6f64eb9a72f19901":
|
||||
# 1.3B PAI control-camera v1.1
|
||||
config = {
|
||||
"has_image_input": True,
|
||||
"patch_size": [1, 2, 2],
|
||||
"in_dim": 32,
|
||||
"dim": 1536,
|
||||
"ffn_dim": 8960,
|
||||
"freq_dim": 256,
|
||||
"text_dim": 4096,
|
||||
"out_dim": 16,
|
||||
"num_heads": 12,
|
||||
"num_layers": 30,
|
||||
"eps": 1e-6,
|
||||
"has_ref_conv": False,
|
||||
"add_control_adapter": True,
|
||||
"in_dim_control_adapter": 24,
|
||||
}
|
||||
elif hash_state_dict_keys(state_dict) == "b61c605c2adbd23124d152ed28e049ae":
|
||||
# 14B PAI control-camera v1.1
|
||||
config = {
|
||||
"has_image_input": True,
|
||||
"patch_size": [1, 2, 2],
|
||||
"in_dim": 32,
|
||||
"dim": 5120,
|
||||
"ffn_dim": 13824,
|
||||
"freq_dim": 256,
|
||||
"text_dim": 4096,
|
||||
"out_dim": 16,
|
||||
"num_heads": 40,
|
||||
"num_layers": 40,
|
||||
"eps": 1e-6,
|
||||
"has_ref_conv": False,
|
||||
"add_control_adapter": True,
|
||||
"in_dim_control_adapter": 24,
|
||||
}
|
||||
else:
|
||||
config = {}
|
||||
return state_dict, config
|
||||
|
||||
Reference in New Issue
Block a user