MCPcopy Create free account
hub / github.com/Tencent/MimicMotion / predict

Method predict

predict.py:89–286  ·  view source on GitHub ↗

Run a single prediction on the model

(
        self,
        motion_video: Path = Input(
            description="Reference video file containing the motion to be mimicked"
        ),
        appearance_image: Path = Input(
            description="Reference image file for the appearance of the generated video"
        ),
        resolution: int = Input(
            description="Height of the output video in pixels. Width is automatically calculated.",
            default=576,
            ge=64,
            le=1024,
        ),
        chunk_size: int = Input(
            description="Number of frames to generate in each processing chunk",
            default=16,
            ge=2,
        ),
        frames_overlap: int = Input(
            description="Number of overlapping frames between chunks for smoother transitions",
            default=6,
            ge=0,
        ),
        denoising_steps: int = Input(
            description="Number of denoising steps in the diffusion process. More steps can improve quality but increase processing time.",
            default=25,
            ge=1,
            le=100,
        ),
        noise_strength: float = Input(
            description="Strength of noise augmentation. Higher values add more variation but may reduce coherence with the reference.",
            default=0.0,
            ge=0.0,
            le=1.0,
        ),
        guidance_scale: float = Input(
            description="Strength of guidance towards the reference. Higher values adhere more closely to the reference but may reduce creativity.",
            default=2.0,
            ge=0.1,
            le=10.0,
        ),
        sample_stride: int = Input(
            description="Interval for sampling frames from the reference video. Higher values skip more frames.",
            default=2,
            ge=1,
        ),
        output_frames_per_second: int = Input(
            description="Frames per second of the output video. Affects playback speed.",
            default=15,
            ge=1,
            le=60,
        ),
        seed: int = Input(
            description="Random seed. Leave blank to randomize the seed",
            default=None,
        ),
        checkpoint_version: str = Input(
            description="Choose the checkpoint version to use",
            choices=["v1", "v1-1"],
            default="v1-1",
        ),
    )

Source from the content-addressed store, hash-verified

87 self.current_dtype = torch.get_default_dtype()
88
89 def predict(
90 self,
91 motion_video: Path = Input(
92 description="Reference video file containing the motion to be mimicked"
93 ),
94 appearance_image: Path = Input(
95 description="Reference image file for the appearance of the generated video"
96 ),
97 resolution: int = Input(
98 description="Height of the output video in pixels. Width is automatically calculated.",
99 default=576,
100 ge=64,
101 le=1024,
102 ),
103 chunk_size: int = Input(
104 description="Number of frames to generate in each processing chunk",
105 default=16,
106 ge=2,
107 ),
108 frames_overlap: int = Input(
109 description="Number of overlapping frames between chunks for smoother transitions",
110 default=6,
111 ge=0,
112 ),
113 denoising_steps: int = Input(
114 description="Number of denoising steps in the diffusion process. More steps can improve quality but increase processing time.",
115 default=25,
116 ge=1,
117 le=100,
118 ),
119 noise_strength: float = Input(
120 description="Strength of noise augmentation. Higher values add more variation but may reduce coherence with the reference.",
121 default=0.0,
122 ge=0.0,
123 le=1.0,
124 ),
125 guidance_scale: float = Input(
126 description="Strength of guidance towards the reference. Higher values adhere more closely to the reference but may reduce creativity.",
127 default=2.0,
128 ge=0.1,
129 le=10.0,
130 ),
131 sample_stride: int = Input(
132 description="Interval for sampling frames from the reference video. Higher values skip more frames.",
133 default=2,
134 ge=1,
135 ),
136 output_frames_per_second: int = Input(
137 description="Frames per second of the output video. Affects playback speed.",
138 default=15,
139 ge=1,
140 le=60,
141 ),
142 seed: int = Input(
143 description="Random seed. Leave blank to randomize the seed",
144 default=None,
145 ),
146 checkpoint_version: str = Input(

Callers

nothing calls this directly

Calls 4

preprocessMethod · 0.95
run_pipelineMethod · 0.95
create_pipelineFunction · 0.90
save_to_mp4Function · 0.90

Tested by

no test coverage detected