[feat] update eval

This commit is contained in:
Zangwei Zheng 2024-04-17 17:35:44 +08:00
parent 380ea6cce8
commit ee2e4083e4
4 changed files with 104 additions and 12 deletions

View file

@ -0,0 +1,20 @@
A fat rabbit wearing a purple robe walking through a fantasy landscape
Waves crashing against a lone lighthouse, ominous lighting
A mystical forest showcasing the adventures of travelers who enter
A blue-haired mage singing
A surreal landscape with floating islands and waterfalls in the sky craft
A blue bird standing in water
A young man walks alone by the seaside
Pink rose on a glass surface with droplets, close-up
Drove viewpoint, a subway train coming out of a tunnel
Space with all planets green and pink color with background of bright white stars
A city floating in an astral space, with stars and nebulae
Sunrise on top of a high-rise building
Pink and cyan powder explosions
Deers in the woods gaze into the camera under the sunlight
In a flash of lightning, a wizard appeared from thin air, his long robes billowing in the wind
A futuristic cyberpunk cityscape at night with towering neon-lit skyscrapers
A scene where the trees, flowers, and animals come together to create a symphony of nature
A ghostly ship sailing through the clouds, navigating through a sea under a moonlit sky
A sunset with beautiful beach
A young man walking alone in the forest

View file

@ -33,6 +33,8 @@ def parse_args(training=False):
# output
parser.add_argument("--save-dir", default=None, type=str, help="path to save generated samples")
parser.add_argument("--sample-name", default=None, type=str, help="sample name, default is sample_idx")
parser.add_argument("--start-index", default=None, type=int, help="start index for sample name")
parser.add_argument("--end-index", default=None, type=int, help="end index for sample name")
# prompt
parser.add_argument("--prompt-path", default=None, type=str, help="path to prompt txt file")
@ -74,6 +76,12 @@ def merge_args(cfg, args, training=False):
if "prompt" not in cfg or cfg["prompt"] is None:
assert cfg["prompt_path"] is not None, "prompt or prompt_path must be provided"
cfg["prompt"] = load_prompts(cfg["prompt_path"])
if args.start_index is not None and args.end_index is not None:
cfg["prompt"] = cfg["prompt"][args.start_index : args.end_index]
elif args.start_index is not None:
cfg["prompt"] = cfg["prompt"][args.start_index :]
elif args.end_index is not None:
cfg["prompt"] = cfg["prompt"][: args.end_index]
if "sample_name" not in cfg:
cfg["sample_name"] = None
else:

View file

@ -85,13 +85,18 @@ def main():
print(cfg)
# init distributed
colossalai.launch_from_torch({})
coordinator = DistCoordinator()
if os.environ.get("WORLD_SIZE", None):
use_dist = True
colossalai.launch_from_torch({})
coordinator = DistCoordinator()
if coordinator.world_size > 1:
set_sequence_parallel_group(dist.group.WORLD)
enable_sequence_parallelism = True
if coordinator.world_size > 1:
set_sequence_parallel_group(dist.group.WORLD)
enable_sequence_parallelism = True
else:
enable_sequence_parallelism = False
else:
use_dist = False
enable_sequence_parallelism = False
# ======================================================
@ -206,7 +211,7 @@ def main():
# 4.7. save video
if loop_i == cfg.loop - 1:
if coordinator.is_master():
if not use_dist or coordinator.is_master():
for idx in range(len(video_clips[0])):
video_clips_i = [video_clips[0][idx]] + [
video_clips[i][idx][:, cfg.condition_frame_length :] for i in range(1, cfg.loop)

View file

@ -1,16 +1,75 @@
set -x;
set -x
CUDA_VISIBLE_DEVICES=7
CMD="python scripts/inference.py configs/opensora-v1-1/inference/sample.py"
CKPT="~/lishenggui/epoch0-global_step8500"
OUTPUT="./outputs/samples_s1_8500"
CKPT="~/lishenggui/epoch0-global_step9000"
OUTPUT="./outputs/samples_s1_9000"
# 1. image
# 1.1 1024x1024
eval $CMD --ckpt-path $CKPT --prompt-path assets/texts/t2i_samples.txt --save-dir $OUTPUT --num-frames 1 --image-size 1024 1024 --sample-name pixart_1024x1024_1
eval $CMD --ckpt-path $CKPT --prompt-path assets/texts/t2i_samples.txt --save-dir $OUTPUT --num-frames 1 --image-size 1024 1024 --sample-name 1024x1024
# 1.2 512x512
# 1.2 240x426
eval $CMD --ckpt-path $CKPT --prompt-path assets/texts/t2i_samples.txt --save-dir $OUTPUT --num-frames 1 --image-size 240 426 --sample-name 240x426 --end-idx 3
# 1.3 240x426
# 1.3 512x512
eval $CMD --ckpt-path $CKPT --prompt-path assets/texts/t2i_samples.txt --save-dir $OUTPUT --num-frames 1 --image-size 512 512 --sample-name 512x512 --end-idx 3
# 1.4 720p multi-resolution
# 1:1
PROMPT = "Bright scene, aerial view,ancient city, fantasy, gorgeous light, mirror reflection, high detail, wide angle lens."
eval $CMD --ckpt-path $CKPT --prompt $PROMPT --save-dir $OUTPUT --num-frames 1 --image-size 960 960 --sample-name 720p_1_1
# 16:9
eval $CMD --ckpt-path $CKPT --prompt $PROMPT --save-dir $OUTPUT --num-frames 1 --image-size 720 1280 --sample-name 720p_16_9
# 9:16
eval $CMD --ckpt-path $CKPT --prompt $PROMPT --save-dir $OUTPUT --num-frames 1 --image-size 1280 720 --sample-name 720p_9_16
# 4:3
eval $CMD --ckpt-path $CKPT --prompt $PROMPT --save-dir $OUTPUT --num-frames 1 --image-size 832 1108 --sample-name 720p_4_3
# 3:4
eval $CMD --ckpt-path $CKPT --prompt $PROMPT --save-dir $OUTPUT --num-frames 1 --image-size 1108 832 --sample-name 720p_3_4
# 1:2
eval $CMD --ckpt-path $CKPT --prompt $PROMPT --save-dir $OUTPUT --num-frames 1 --image-size 1358 600 --sample-name 720p_1_2
# 2:1
eval $CMD --ckpt-path $CKPT --prompt $PROMPT --save-dir $OUTPUT --num-frames 1 --image-size 600 1358 --sample-name 720p_2_1
# 2. video
# 1.1 16x240x426
eval $CMD --ckpt-path $CKPT --prompt-path assets/texts/t2v_samples.txt --save-dir $OUTPUT --num-frames 16 --image-size 240 426 --sample-name sample_16x240x426
eval $CMD --ckpt-path $CKPT --prompt-path assets/texts/t2v_short.txt --save-dir $OUTPUT --num-frames 16 --image-size 240 426 --sample-name short_16x240x426
eval $CMD --ckpt-path $CKPT --prompt-path assets/texts/t2v_sora.txt --save-dir $OUTPUT --num-frames 16 --image-size 240 426 --sample-name sora_16x240x426
# 1.2 64x240x426
eval $CMD --ckpt-path $CKPT --prompt-path assets/texts/t2v_short.txt --save-dir $OUTPUT --num-frames 64 --image-size 240 426 --sample-name short_64x240x426
# 1.3 128x240x426
eval $CMD --ckpt-path $CKPT --prompt-path assets/texts/t2v_short.txt --save-dir $OUTPUT --num-frames 128 --image-size 240 426 --sample-name short_128x240x426
# 1.4 16x480x854
eval $CMD --ckpt-path $CKPT --prompt-path assets/texts/t2v_short.txt --save-dir $OUTPUT --num-frames 16 --image-size 480 854 --sample-name short_16x480x854
# 1.5 64x480x854
eval $CMD --ckpt-path $CKPT --prompt-path assets/texts/t2v_short.txt --save-dir $OUTPUT --num-frames 64 --image-size 480 854 --sample-name short_64x480x854
# 1.6 16x720x1280
eval $CMD --ckpt-path $CKPT --prompt-path assets/texts/t2v_short.txt --save-dir $OUTPUT --num-frames 16 --image-size 720 1280 --sample-name short_16x720x1280
# 1.7 16x720p multi-resolution
# 1:1
PROMPT = "A soaring drone footage captures the majestic beauty of a coastal cliff, its red and yellow stratified rock faces rich in color and against the vibrant turquoise of the sea. Seabirds can be seen taking flight around the cliff's precipices. As the drone slowly moves from different angles, the changing sunlight casts shifting shadows that highlight the rugged textures of the cliff and the surrounding calm sea. The water gently laps at the rock base and the greenery that clings to the top of the cliff, and the scene gives a sense of peaceful isolation at the fringes of the ocean. The video captures the essence of pristine natural beauty untouched by human structures."
eval $CMD --ckpt-path $CKPT --prompt $PROMPT --save-dir $OUTPUT --num-frames 16 --image-size 960 960 --sample-name 720p_1_1
# 16:9
eval $CMD --ckpt-path $CKPT --prompt $PROMPT --save-dir $OUTPUT --num-frames 16 --image-size 720 1280 --sample-name 720p_16_9
# 9:16
eval $CMD --ckpt-path $CKPT --prompt $PROMPT --save-dir $OUTPUT --num-frames 16 --image-size 1280 720 --sample-name 720p_9_16
# 4:3
eval $CMD --ckpt-path $CKPT --prompt $PROMPT --save-dir $OUTPUT --num-frames 16 --image-size 832 1108 --sample-name 720p_4_3
# 3:4
eval $CMD --ckpt-path $CKPT --prompt $PROMPT --save-dir $OUTPUT --num-frames 16 --image-size 1108 832 --sample-name 720p_3_4
# 1:2
eval $CMD --ckpt-path $CKPT --prompt $PROMPT --save-dir $OUTPUT --num-frames 16 --image-size 1358 600 --sample-name 720p_1_2
# 2:1
eval $CMD --ckpt-path $CKPT --prompt $PROMPT --save-dir $OUTPUT --num-frames 16 --image-size 600 1358 --sample-name 720p_2_1
# 3. video edit