Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
renzhc
diffusers_dcu
Commits
59f1b7b1
Unverified
Commit
59f1b7b1
authored
Apr 16, 2025
by
Dhruv Nair
Committed by
GitHub
Apr 16, 2025
Browse files
Hunyuan I2V fast tests fix (#11341)
* update * update
parent
ce1063ac
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
10 deletions
+26
-10
src/diffusers/pipelines/hunyuan_video/pipeline_hunyuan_video_image2video.py
...lines/hunyuan_video/pipeline_hunyuan_video_image2video.py
+1
-1
tests/pipelines/hunyuan_video/test_hunyuan_image2video.py
tests/pipelines/hunyuan_video/test_hunyuan_image2video.py
+25
-9
No files found.
src/diffusers/pipelines/hunyuan_video/pipeline_hunyuan_video_image2video.py
View file @
59f1b7b1
...
...
@@ -344,7 +344,7 @@ class HunyuanVideoImageToVideoPipeline(DiffusionPipeline, HunyuanVideoLoraLoader
)
prompt_embeds
=
self
.
text_encoder
(
**
expanded_inputs
,
pixel_value
=
image_embeds
,
pixel_value
s
=
image_embeds
,
output_hidden_states
=
True
,
).
hidden_states
[
-
(
num_hidden_layers_to_skip
+
1
)]
prompt_embeds
=
prompt_embeds
.
to
(
dtype
=
dtype
)
...
...
tests/pipelines/hunyuan_video/test_hunyuan_image2video.py
View file @
59f1b7b1
...
...
@@ -24,9 +24,11 @@ from transformers import (
CLIPTextModel
,
CLIPTokenizer
,
LlamaConfig
,
LlamaModel
,
LlamaTokenizer
,
LlamaTokenizerFast
,
LlavaConfig
,
LlavaForConditionalGeneration
,
)
from
transformers.models.clip
import
CLIPVisionConfig
from
diffusers
import
(
AutoencoderKLHunyuanVideo
,
...
...
@@ -116,7 +118,7 @@ class HunyuanVideoImageToVideoPipelineFastTests(
torch
.
manual_seed
(
0
)
scheduler
=
FlowMatchEulerDiscreteScheduler
(
shift
=
7.0
)
llama_text_encoder
_config
=
LlamaConfig
(
text
_config
=
LlamaConfig
(
bos_token_id
=
0
,
eos_token_id
=
2
,
hidden_size
=
16
,
...
...
@@ -124,11 +126,21 @@ class HunyuanVideoImageToVideoPipelineFastTests(
layer_norm_eps
=
1e-05
,
num_attention_heads
=
4
,
num_hidden_layers
=
2
,
pad_token_id
=
1
,
pad_token_id
=
1
00
,
vocab_size
=
1000
,
hidden_act
=
"gelu"
,
projection_dim
=
32
,
)
vision_config
=
CLIPVisionConfig
(
hidden_size
=
8
,
intermediate_size
=
37
,
projection_dim
=
32
,
num_attention_heads
=
4
,
num_hidden_layers
=
2
,
image_size
=
224
,
)
llava_text_encoder_config
=
LlavaConfig
(
vision_config
,
text_config
,
pad_token_id
=
100
,
image_token_index
=
101
)
clip_text_encoder_config
=
CLIPTextConfig
(
bos_token_id
=
0
,
eos_token_id
=
2
,
...
...
@@ -144,8 +156,8 @@ class HunyuanVideoImageToVideoPipelineFastTests(
)
torch
.
manual_seed
(
0
)
text_encoder
=
Lla
maModel
(
lla
m
a_text_encoder_config
)
tokenizer
=
LlamaTokenizer
.
from_pretrained
(
"finetrainers/dummy-hunyaunvideo"
,
subfolder
=
"tokenizer"
)
text_encoder
=
Lla
vaForConditionalGeneration
(
lla
v
a_text_encoder_config
)
tokenizer
=
LlamaTokenizer
Fast
.
from_pretrained
(
"finetrainers/dummy-hunyaunvideo"
,
subfolder
=
"tokenizer"
)
torch
.
manual_seed
(
0
)
text_encoder_2
=
CLIPTextModel
(
clip_text_encoder_config
)
...
...
@@ -153,14 +165,14 @@ class HunyuanVideoImageToVideoPipelineFastTests(
torch
.
manual_seed
(
0
)
image_processor
=
CLIPImageProcessor
(
crop_size
=
336
,
crop_size
=
224
,
do_center_crop
=
True
,
do_normalize
=
True
,
do_resize
=
True
,
image_mean
=
[
0.48145466
,
0.4578275
,
0.40821073
],
image_std
=
[
0.26862954
,
0.26130258
,
0.27577711
],
resample
=
3
,
size
=
336
,
size
=
224
,
)
components
=
{
...
...
@@ -190,6 +202,10 @@ class HunyuanVideoImageToVideoPipelineFastTests(
"prompt_template"
:
{
"template"
:
"{}"
,
"crop_start"
:
0
,
"image_emb_len"
:
49
,
"image_emb_start"
:
5
,
"image_emb_end"
:
54
,
"double_return_token_id"
:
0
,
},
"generator"
:
generator
,
"num_inference_steps"
:
2
,
...
...
@@ -197,7 +213,7 @@ class HunyuanVideoImageToVideoPipelineFastTests(
"height"
:
image_height
,
"width"
:
image_width
,
"num_frames"
:
9
,
"max_sequence_length"
:
1
6
,
"max_sequence_length"
:
6
4
,
"output_type"
:
"pt"
,
}
return
inputs
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment