Matrix-Game icon indicating copy to clipboard operation
Matrix-Game copied to clipboard

Inference code and config using base model 使用基模型输出的图像是纯噪声

Open LeeKeyu opened this issue 1 year ago • 5 comments

Dear authors, thanks for your inspiring work. Could you please add the implementation of inference using base model instead of the distilled ones? I think the provided code lacked specification of how to use the pretrained base model weight provided on huggingface. Thanks a lot in advance!

LeeKeyu avatar Sep 17 '25 01:09 LeeKeyu

您好,我尝试复现base model的效果,使用: python inference_streaming.py --config_path configs/inference_yaml/inference_universal_base.yaml --checkpoint_path Matrix-Game-2.0/base_model/diffusion_pytorch_model.safetensors --img_path demo_images/universal/0000.png --output_folder outputs --seed 42 --pretrained_model_path Matrix-Game-2.0 并把scheduler设为默认的100步,输出的图像为纯噪声。请问有哪些需要修改的地方吗?感谢!

LeeKeyu avatar Sep 17 '25 06:09 LeeKeyu

Thanks for your interest in Matrix-Game v2! Maybe the pre-trained VAE checkpoint was not loaded. It is supposed to check if you've downloaded the checkpoint from HuggingFace and try again.

XianglongHe avatar Sep 26 '25 12:09 XianglongHe

Thanks for your interest in Matrix-Game v2! Maybe the pre-trained VAE checkpoint was not loaded. It is supposed to check if you've downloaded the checkpoint from HuggingFace and try again.

@XianglongHe Hi Xianglong, thanks for your reply. I have prepared the VAE checkpoint, and it works when using the distilled model for inference. My question is how to run the base model without distillation, as the inference config only supports the distilled models. Could you please add an implementation of the inference using the base model? Thank you a lot!

LeeKeyu avatar Oct 09 '25 02:10 LeeKeyu

@XianglongHe hello I am Sayak. One of the maintainers of diffusers.

Thanks for open-sourcing this work!

I am running:

python inference.py \
    --config_path configs/inference_yaml/inference_gta_drive.yaml \
    --checkpoint_path Matrix-Game-2.0/base_distilled_model/base_distill.safetensors \
    --img_path demo_images/gta_drive/0000.png \
    --output_folder outputs \
    --num_output_frames 150 \
    --seed 42 \
    --pretrained_model_path Matrix-Game-2.0

However, it leads to:

Error
RuntimeError: Error(s) in loading state_dict for WanDiffusionWrapper:
        size mismatch for model.blocks.0.action_model.keyboard_embed.0.weight: copying a param with shape torch.Size([128, 4]) from checkpoint, the shape in current model is torch.Size([128, 2]).
        size mismatch for model.blocks.1.action_model.keyboard_embed.0.weight: copying a param with shape torch.Size([128, 4]) from checkpoint, the shape in current model is torch.Size([128, 2]).
        size mismatch for model.blocks.2.action_model.keyboard_embed.0.weight: copying a param with shape torch.Size([128, 4]) from checkpoint, the shape in current model is torch.Size([128, 2]).
        size mismatch for model.blocks.3.action_model.keyboard_embed.0.weight: copying a param with shape torch.Size([128, 4]) from checkpoint, the shape in current model is torch.Size([128, 2]).
        size mismatch for model.blocks.4.action_model.keyboard_embed.0.weight: copying a param with shape torch.Size([128, 4]) from checkpoint, the shape in current model is torch.Size([128, 2]).
        size mismatch for model.blocks.5.action_model.keyboard_embed.0.weight: copying a param with shape torch.Size([128, 4]) from checkpoint, the shape in current model is torch.Size([128, 2]).
        size mismatch for model.blocks.6.action_model.keyboard_embed.0.weight: copying a param with shape torch.Size([128, 4]) from checkpoint, the shape in current model is torch.Size([128, 2]).
        size mismatch for model.blocks.7.action_model.keyboard_embed.0.weight: copying a param with shape torch.Size([128, 4]) from checkpoint, the shape in current model is torch.Size([128, 2]).
        size mismatch for model.blocks.8.action_model.keyboard_embed.0.weight: copying a param with shape torch.Size([128, 4]) from checkpoint, the shape in current model is torch.Size([128, 2]).
        size mismatch for model.blocks.9.action_model.keyboard_embed.0.weight: copying a param with shape torch.Size([128, 4]) from checkpoint, the shape in current model is torch.Size([128, 2]).
        size mismatch for model.blocks.10.action_model.keyboard_embed.0.weight: copying a param with shape torch.Size([128, 4]) from checkpoint, the shape in current model is torch.Size([128, 2]).
        size mismatch for model.blocks.11.action_model.keyboard_embed.0.weight: copying a param with shape torch.Size([128, 4]) from checkpoint, the shape in current model is torch.Size([128, 2]).
        size mismatch for model.blocks.12.action_model.keyboard_embed.0.weight: copying a param with shape torch.Size([128, 4]) from checkpoint, the shape in current model is torch.Size([128, 2]).
        size mismatch for model.blocks.13.action_model.keyboard_embed.0.weight: copying a param with shape torch.Size([128, 4]) from checkpoint, the shape in current model is torch.Size([128, 2]).
        size mismatch for model.blocks.14.action_model.keyboard_embed.0.weight: copying a param with shape torch.Size([128, 4]) from checkpoint, the shape in current model is torch.Size([128, 2]).

Do you have any suggestions on how to resolve this?

sayakpaul avatar Dec 25 '25 05:12 sayakpaul

Thanks for your interest in Matrix-Game v2! Maybe the pre-trained VAE checkpoint was not loaded. It is supposed to check if you've downloaded the checkpoint from HuggingFace and try again.

你好,问一下base_model有启动脚本吗?这块跑出来都是噪声。

liushuchun avatar Dec 25 '25 12:12 liushuchun