mirror of
https://github.com/THUDM/CogVideo.git
synced 2025-06-22 00:29:23 +08:00
fix: fix resolution handling for different model types
This commit is contained in:
parent
0e26f54cbe
commit
d9e2a415e8
@ -100,7 +100,7 @@ def generate_video(
|
|||||||
if width is None or height is None:
|
if width is None or height is None:
|
||||||
height, width = desired_resolution
|
height, width = desired_resolution
|
||||||
logging.info(f"\033[1mUsing default resolution {desired_resolution} for {model_name}\033[0m")
|
logging.info(f"\033[1mUsing default resolution {desired_resolution} for {model_name}\033[0m")
|
||||||
elif (width, height) != desired_resolution:
|
elif (height, width) != desired_resolution:
|
||||||
if generate_type == "i2v":
|
if generate_type == "i2v":
|
||||||
# For i2v models, use user-defined width and height
|
# For i2v models, use user-defined width and height
|
||||||
logging.warning(
|
logging.warning(
|
||||||
@ -111,7 +111,7 @@ def generate_video(
|
|||||||
logging.warning(
|
logging.warning(
|
||||||
f"\033[1;31m{model_name} is not supported for custom resolution. Setting back to default resolution {desired_resolution}.\033[0m"
|
f"\033[1;31m{model_name} is not supported for custom resolution. Setting back to default resolution {desired_resolution}.\033[0m"
|
||||||
)
|
)
|
||||||
width, height = desired_resolution
|
height, width = desired_resolution
|
||||||
|
|
||||||
if generate_type == "i2v":
|
if generate_type == "i2v":
|
||||||
pipe = CogVideoXImageToVideoPipeline.from_pretrained(model_path, torch_dtype=dtype)
|
pipe = CogVideoXImageToVideoPipeline.from_pretrained(model_path, torch_dtype=dtype)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user