[Cosmos 3] Preserve image and video conditioning with supplied latents
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 48/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Lĩnh vực
- machine-learning
Hướng nghiên cứu
Start by reading the Cosmos 3 Omni standard pipeline’s latent preparation and masked-position initialization, then trace the corresponding modular image-to-video and video-to-video paths. Use the reproduction to compare internally sampled noise with the same noise passed through latents, for both image and video conditioning. Done means explicit latents preserve the reference conditioning and match the internally sampled path for the same inputs.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
Passing pre-generated vision latents to Cosmos 3 Omni skips the step that initializes the masked positions from the reference image or video. With the same supplied noise, switching a red reference to blue leaves the standard pipeline output identical in the example below. Sampling the noise inside the pipeline correctly responds to the reference.
The same missing initialization also causes the modular image-to-video and video-to-video paths to diverge when given noise drawn from the same seed. I can send one fix for the standard pipeline and the corresponding modular block if this scope looks right.
Reproduction
The following uses the standard pipeline and compares its internal noise with the same noise supplied explicitly.
import torch
from PIL import Image
from tokenizers import Tokenizer, models, pre_tokenizers
from transformers import PreTrainedTokenizerFast
from diffusers import AutoencoderKLWan, Cosmos3OmniPipeline, Cosmos3OmniTransformer, UniPCMultistepScheduler
from diffusers.utils.torch_utils import randn_tensor
def build_pipeline():
tokenizer = Tokenizer(models.WordLevel({"<unk>": 0, "<eos>": 1, "<|vision_start|>": 2}, unk_token="<unk>"))
tokenizer.pre_tokenizer = pre_tokenizers.Whitespace()
tokenizer = PreTrainedTokenizerFast(tokenizer_object=tokenizer, unk_token="<unk>", eos_token="<eos>")
tokenizer.chat_template = "{% for message in messages %}{{ message['content'] }}{% endfor %}"
torch.manual_seed(0)
transformer = Cosmos3OmniTransformer(
head_dim=6, hidden_act="relu2", hidden_size=6, intermediate_size=12, latent_channel=16, latent_patch_size=1,
num_attention_heads=1, num_hidden_layers=1, num_key_value_heads=1, patch_latent_dim=16,
qk_norm_for_text=False, rms_norm_eps=1e-5, rope_axes_dim=[1, 1, 1], vocab_size=3,
)
vae = AutoencoderKLWan(
base_dim=3, z_dim=16, dim_mult=[1, 1, 1, 1], num_res_blocks=1, temperal_downsample=[False, True, True],
)
pipe = Cosmos3OmniPipeline(
transformer=transformer, text_tokenizer=tokenizer, vae=vae, scheduler=UniPCMultistepScheduler(),
enable_safety_checker=False,
)
pipe.set_progress_bar_config(disable=True)
return pipe
torch.set_num_threads(1)
pipe = build_pipeline()
common = dict(
prompt="a dog", negative_prompt="bad quality", height=16, width=16, num_inference_steps=2,
guidance_scale=1.0, output_type="latent", use_system_prompt=False, add_resolution_template=False,
add_duration_template=False,
)
def gen():
return torch.Generator().manual_seed(0)
red = Image.new("RGB", (16, 16), "red")
blue = Image.new("RGB", (16, 16), "blue")
for key, a, b, frames in (
("image", red, blue, 5),
("video", [red] * 5, [blue] * 5, 9),
):
expected = pipe(**common, **{key: a}, num_frames=frames, generator=gen()).video
other_reference = pipe(**common, **{key: b}, num_frames=frames, generator=gen()).video
assert (expected[:, :, :1] - other_reference[:, :, :1]).abs().max() > 0
noise = randn_tensor(expected.shape, generator=gen(), dtype=expected.dtype)
actual = pipe(**common, **{key: a}, num_frames=frames, latents=noise).video
other = pipe(**common, **{key: b}, num_frames=frames, latents=noise).video
same_inputs_max_error = (expected - actual).abs().max().item()
changed_condition_max_effect = (actual - other).abs().max().item()
print(
f"{key} conditioning with explicit noise: "
f"same inputs max error={same_inputs_max_error:.6f}; "
f"changing conditioning max effect={changed_condition_max_effect:.6f}"
)
Logs
image conditioning with explicit noise: same inputs max error=663.352112; changing conditioning max effect=0.000000
video conditioning with explicit noise: same inputs max error=484.900635; changing conditioning max effect=0.000000
System Info
Diffusers 0.44.0.dev0 at 8edb6d8, Windows 11 x64, Python 3.12.14, PyTorch 2.11.0+cpu, Transformers 5.20.0. CPU with tiny randomly initialized components.
- Ngôn ngữ chính
- Python
- Star
- 34.9k
- Fork
- 7.5k
- Merge trung bình
- 3 ngày 16 giờ
- Pull request đã merge (30 ngày)
- 65
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của huggingface/diffusers
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
huggingface/diffusers#15363 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`ZImageImg2ImgPipeline` / `ZImageInpaintPipeline`: explicit height/width different from the input image raises RuntimeErrorCó thể đã có người làm @chessing234 đã nhận 1 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
huggingface/diffusers#15337 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Multi-vector textual inversion uses only the first vector when the token has uppercase letters (transformers v5)Có thể đã có người làm @sunhouy đã nhận 2 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
huggingface/diffusers#15313 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
TCDScheduler advances the generator on the final step of a strength-truncated custom scheduleCó thể đã có người làm @SIDDARTHAREDDY8 đã nhận 5 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
huggingface/diffusers#15288 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
unload_textual_inversion(token) leaves the extra tokens of a multi-vector embedding behind, so it can't be loaded againCó thể đã có người làm @sohailshk đã nhận 11 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
huggingface/diffusers#15211 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của huggingface/diffusers
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Unused loot bag group names left in dreamcraft en_US.langCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởStatus: Triage Suggestion
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
GTNewHorizons/GT-New-Horizons-Modpack#27789 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug frontend sev-5
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
-
core good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
b4b code health next
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
ESCOMP/CTSM#4330 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày