Skip to content

Commit 73147d4

Browse files
support neo++ fp8 (#993)
1 parent c3b0d63 commit 73147d4

6 files changed

Lines changed: 319 additions & 23 deletions

File tree

configs/neopp/neopp_dense_fp8.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"version": "dense",
3+
"load_kv_cache_in_pipeline_for_debug": true,
4+
"infer_steps": 50,
5+
"attn_type": "flash_attn3",
6+
"cfg_scale": 4.0,
7+
"timestep_shift": 3.0,
8+
"cfg_interval": [-1, 2],
9+
"enable_cfg": true,
10+
"dit_quantized": true,
11+
"dit_quant_scheme": "fp8-sgl"
12+
}

examples/neopp/neopp_dense_1k.py

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# -------------------------------------------------
66

77
pipe = LightX2VPipeline(
8-
model_path="/data/nvme1/yongyang/FL/neo_9b_new/hf_step4000_ema",
8+
model_path="/data/nvme1/yongyang/FL/neo_9b_new/hf_step44000_ema_x2v_part",
99
model_cls="neopp",
1010
support_tasks=["t2i", "i2i"],
1111
)
@@ -22,15 +22,15 @@
2222
# TURN 0
2323
# -------------------------------------------------
2424
pipe.runner.load_kvcache(
25-
"/data/nvme1/yongyang/FL/neo_9b_new/vlm_tensor/to_x2v_cond_kv_0_289.pt",
26-
"/data/nvme1/yongyang/FL/neo_9b_new/vlm_tensor/to_x2v_uncond_kv_0_9.pt",
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",
2727
)
2828
pipe.runner.set_inference_params(
29-
index_offset_cond=289,
29+
index_offset_cond=298,
3030
index_offset_uncond=9,
3131
cfg_interval=(-1, 2),
3232
cfg_scale=4.0,
33-
cfg_norm="global",
33+
cfg_norm="none",
3434
timestep_shift=3.0,
3535
)
3636

@@ -45,20 +45,43 @@
4545
# TURN 1
4646
# -------------------------------------------------
4747
pipe.runner.load_kvcache(
48-
"/data/nvme1/yongyang/FL/neo_9b_new/vlm_tensor/to_x2v_cond_kv_1_346.pt",
49-
"/data/nvme1/yongyang/FL/neo_9b_new/vlm_tensor/to_x2v_uncond_kv_1_12.pt",
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",
5050
)
5151
pipe.runner.set_inference_params(
52-
index_offset_cond=346,
52+
index_offset_cond=366,
5353
index_offset_uncond=12,
5454
cfg_interval=(-1, 2),
5555
cfg_scale=4.0,
56-
cfg_norm="global",
56+
cfg_norm="none",
5757
timestep_shift=3.0,
5858
)
5959

6060
pipe.generate(
61-
seed=200,
61+
seed=201,
6262
save_result_path="/data/nvme1/yongyang/FL/LightX2V/save_results/output_lightx2v_neopp_dense_1k_1.png",
6363
target_shape=[1024, 1024], # Height, Width
6464
)
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_2.png",
86+
target_shape=[1024, 1024], # Height, Width
87+
)
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
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+
)

examples/neopp/neopp_dense_2k.py

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
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",
9+
model_cls="neopp",
10+
support_tasks=["t2i", "i2i"],
11+
)
12+
13+
pipe.create_generator(config_json="../../configs/neopp/neopp_dense.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_2k/to_x2v_cond_kv_0_298.pt",
26+
"/data/nvme1/yongyang/FL/neo_9b_new/vlm_tensor_44000_ema_2k/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_2k_0.png",
40+
target_shape=[2048, 2048], # 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_2k/to_x2v_cond_kv_1_360.pt",
49+
"/data/nvme1/yongyang/FL/neo_9b_new/vlm_tensor_44000_ema_2k/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_2k_1.png",
63+
target_shape=[2048, 2048], # 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_2k/to_x2v_cond_kv_2_439.pt",
72+
"/data/nvme1/yongyang/FL/neo_9b_new/vlm_tensor_44000_ema_2k/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_2k_2.png",
86+
target_shape=[2048, 2048], # Height, Width
87+
)
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
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_2k/to_x2v_cond_kv_0_298.pt",
26+
"/data/nvme1/yongyang/FL/neo_9b_new/vlm_tensor_44000_ema_2k/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_2k_fp8_0.png",
40+
target_shape=[2048, 2048], # 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_2k/to_x2v_cond_kv_1_360.pt",
49+
"/data/nvme1/yongyang/FL/neo_9b_new/vlm_tensor_44000_ema_2k/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_2k_fp8_1.png",
63+
target_shape=[2048, 2048], # 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_2k/to_x2v_cond_kv_2_439.pt",
72+
"/data/nvme1/yongyang/FL/neo_9b_new/vlm_tensor_44000_ema_2k/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_2k_fp8_2.png",
86+
target_shape=[2048, 2048], # Height, Width
87+
)

0 commit comments

Comments
 (0)