You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: inference/cli_demo.py
+12-1Lines changed: 12 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,8 @@ def generate_video(
37
37
lora_path: str=None,
38
38
lora_rank: int=128,
39
39
num_frames: int=81,
40
+
width: int=1360,
41
+
height: int=768,
40
42
output_path: str="./output.mp4",
41
43
image_or_video_path: str="",
42
44
num_inference_steps: int=50,
@@ -58,6 +60,8 @@ def generate_video(
58
60
- output_path (str): The path where the generated video will be saved.
59
61
- num_inference_steps (int): Number of steps for the inference process. More steps can result in better quality.
60
62
- num_frames (int): Number of frames to generate. CogVideoX1.0 generates 49 frames for 6 seconds at 8 fps, while CogVideoX1.5 produces either 81 or 161 frames, corresponding to 5 seconds or 10 seconds at 16 fps.
63
+
- width (int): The width of the generated video, applicable only for CogVideoX1.5-5B-I2V
64
+
- height (int): The height of the generated video, applicable only for CogVideoX1.5-5B-I2V
61
65
- guidance_scale (float): The scale for classifier-free guidance. Higher values can lead to better alignment with the prompt.
62
66
- num_videos_per_prompt (int): Number of videos to generate per prompt.
63
67
- dtype (torch.dtype): The data type for computation (default is torch.bfloat16).
@@ -111,8 +115,11 @@ def generate_video(
111
115
# This is the default value for 6 seconds video and 8 fps and will plus 1 frame for the first frame and 49 frames.
112
116
ifgenerate_type=="i2v":
113
117
video_generate=pipe(
118
+
height=height,
119
+
width=width,
114
120
prompt=prompt,
115
-
image=image, # The path of the image, the resolution of video will be the same as the image for CogVideoX1.5-5B-I2V, otherwise it will be 720 * 480
121
+
image=image,
122
+
# The path of the image, the resolution of video will be the same as the image for CogVideoX1.5-5B-I2V, otherwise it will be 720 * 480
116
123
num_videos_per_prompt=num_videos_per_prompt, # Number of videos to generate per prompt
117
124
num_inference_steps=num_inference_steps, # Number of inference steps
118
125
num_frames=num_frames, # Number of frames to generate
@@ -162,6 +169,8 @@ def generate_video(
162
169
parser.add_argument("--guidance_scale", type=float, default=6.0, help="The scale for classifier-free guidance")
0 commit comments