|
| 1 | +from lightx2v import LightX2VPipeline |
| 2 | + |
| 3 | +# ------------------------------------------------- |
| 4 | +# Initialize pipeline for NeoPP |
| 5 | +# ------------------------------------------------- |
| 6 | + |
| 7 | +pipe = LightX2VPipeline( |
| 8 | + model_path="/data/nvme1/yongyang/FL/neo_9b_new/hf_step44000_ema_x2v_part_fp8", |
| 9 | + model_cls="neopp", |
| 10 | + support_tasks=["t2i", "i2i"], |
| 11 | +) |
| 12 | + |
| 13 | +pipe.create_generator(config_json="../../configs/neopp/neopp_dense_fp8.json") |
| 14 | +pipe.modify_config({"load_kv_cache_in_pipeline_for_debug": False, "save_result_for_debug": True}) |
| 15 | + |
| 16 | + |
| 17 | +# ------------------------------------------------- |
| 18 | +# Load KV cache and generate |
| 19 | +# ------------------------------------------------- |
| 20 | + |
| 21 | +# ------------------------------------------------- |
| 22 | +# TURN 0 |
| 23 | +# ------------------------------------------------- |
| 24 | +pipe.runner.load_kvcache( |
| 25 | + "/data/nvme1/yongyang/FL/neo_9b_new/vlm_tensor_44000_ema_1k/to_x2v_cond_kv_0_298.pt", |
| 26 | + "/data/nvme1/yongyang/FL/neo_9b_new/vlm_tensor_44000_ema_1k/to_x2v_uncond_kv_0_9.pt", |
| 27 | +) |
| 28 | +pipe.runner.set_inference_params( |
| 29 | + index_offset_cond=298, |
| 30 | + index_offset_uncond=9, |
| 31 | + cfg_interval=(-1, 2), |
| 32 | + cfg_scale=4.0, |
| 33 | + cfg_norm="none", |
| 34 | + timestep_shift=3.0, |
| 35 | +) |
| 36 | + |
| 37 | +pipe.generate( |
| 38 | + seed=200, |
| 39 | + save_result_path="/data/nvme1/yongyang/FL/LightX2V/save_results/output_lightx2v_neopp_dense_1k_fp8_0.png", |
| 40 | + target_shape=[1024, 1024], # Height, Width |
| 41 | +) |
| 42 | + |
| 43 | + |
| 44 | +# ------------------------------------------------- |
| 45 | +# TURN 1 |
| 46 | +# ------------------------------------------------- |
| 47 | +pipe.runner.load_kvcache( |
| 48 | + "/data/nvme1/yongyang/FL/neo_9b_new/vlm_tensor_44000_ema_1k/to_x2v_cond_kv_1_366.pt", |
| 49 | + "/data/nvme1/yongyang/FL/neo_9b_new/vlm_tensor_44000_ema_1k/to_x2v_uncond_kv_1_12.pt", |
| 50 | +) |
| 51 | +pipe.runner.set_inference_params( |
| 52 | + index_offset_cond=366, |
| 53 | + index_offset_uncond=12, |
| 54 | + cfg_interval=(-1, 2), |
| 55 | + cfg_scale=4.0, |
| 56 | + cfg_norm="none", |
| 57 | + timestep_shift=3.0, |
| 58 | +) |
| 59 | + |
| 60 | +pipe.generate( |
| 61 | + seed=201, |
| 62 | + save_result_path="/data/nvme1/yongyang/FL/LightX2V/save_results/output_lightx2v_neopp_dense_1k_fp8_1.png", |
| 63 | + target_shape=[1024, 1024], # Height, Width |
| 64 | +) |
| 65 | + |
| 66 | + |
| 67 | +# ------------------------------------------------- |
| 68 | +# TURN 2 |
| 69 | +# ------------------------------------------------- |
| 70 | +pipe.runner.load_kvcache( |
| 71 | + "/data/nvme1/yongyang/FL/neo_9b_new/vlm_tensor_44000_ema_1k/to_x2v_cond_kv_2_441.pt", |
| 72 | + "/data/nvme1/yongyang/FL/neo_9b_new/vlm_tensor_44000_ema_1k/to_x2v_uncond_kv_2_15.pt", |
| 73 | +) |
| 74 | +pipe.runner.set_inference_params( |
| 75 | + index_offset_cond=441, |
| 76 | + index_offset_uncond=15, |
| 77 | + cfg_interval=(-1, 2), |
| 78 | + cfg_scale=4.0, |
| 79 | + cfg_norm="none", |
| 80 | + timestep_shift=3.0, |
| 81 | +) |
| 82 | + |
| 83 | +pipe.generate( |
| 84 | + seed=202, |
| 85 | + save_result_path="/data/nvme1/yongyang/FL/LightX2V/save_results/output_lightx2v_neopp_dense_1k_fp8_2.png", |
| 86 | + target_shape=[1024, 1024], # Height, Width |
| 87 | +) |
0 commit comments