[bugfix] VideoGenerator improperly extracts output_video_name (#649)
This commit is contained in:
@@ -23,6 +23,7 @@ class SamplingParam:
|
||||
negative_prompt: str | None = None
|
||||
prompt_path: str | None = None
|
||||
output_path: str = "outputs/"
|
||||
output_video_name: str | None = None
|
||||
|
||||
# Batch info
|
||||
num_videos_per_prompt: int = 1
|
||||
@@ -106,6 +107,12 @@ class SamplingParam:
|
||||
default=SamplingParam.output_path,
|
||||
help="Path to save the generated video",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--output-video-name",
|
||||
type=str,
|
||||
default=SamplingParam.output_video_name,
|
||||
help="Name of the output video",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--num-videos-per-prompt",
|
||||
type=int,
|
||||
|
||||
@@ -141,6 +141,11 @@ class VideoGenerator:
|
||||
|
||||
logger.info("Found %d prompts in %s", len(prompts), prompt_txt_path)
|
||||
|
||||
if sampling_param is not None:
|
||||
original_output_video_name = sampling_param.output_video_name
|
||||
else:
|
||||
original_output_video_name = None
|
||||
|
||||
results = []
|
||||
for i, batch_prompt in enumerate(prompts):
|
||||
logger.info("Processing prompt %d/%d: %s...", i + 1,
|
||||
@@ -148,6 +153,8 @@ class VideoGenerator:
|
||||
|
||||
try:
|
||||
# Generate video for this prompt using the same logic below
|
||||
if sampling_param is not None and original_output_video_name is not None:
|
||||
sampling_param.output_video_name = original_output_video_name + f"_{i}"
|
||||
result = self._generate_single_video(
|
||||
batch_prompt, sampling_param, **kwargs)
|
||||
|
||||
@@ -282,7 +289,8 @@ class VideoGenerator:
|
||||
logger.info(debug_str)
|
||||
|
||||
# Use prompt[:100] for video name
|
||||
output_video_name = kwargs.get("output_video_name", prompt[:100])
|
||||
if sampling_param.output_video_name is None:
|
||||
sampling_param.output_video_name = prompt[:100]
|
||||
|
||||
# Prepare batch
|
||||
batch = ForwardBatch(
|
||||
@@ -291,7 +299,6 @@ class VideoGenerator:
|
||||
n_tokens=n_tokens,
|
||||
VSA_sparsity=fastvideo_args.VSA_sparsity,
|
||||
extra={},
|
||||
output_video_name=output_video_name,
|
||||
)
|
||||
|
||||
# Run inference
|
||||
|
||||
Reference in New Issue
Block a user