Skip to content

Commit 7c4eced

Browse files
committed
style tests
1 parent 8e328f3 commit 7c4eced

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

tests/pipelines/hidream/test_pipeline_hidream.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,21 @@
1717

1818
import numpy as np
1919
import torch
20-
from transformers import CLIPTokenizer, CLIPTextConfig, CLIPTextModelWithProjection, T5EncoderModel, AutoTokenizer, LlamaForCausalLM, PreTrainedTokenizerFast
20+
from transformers import (
21+
AutoTokenizer,
22+
CLIPTextConfig,
23+
CLIPTextModelWithProjection,
24+
CLIPTokenizer,
25+
LlamaForCausalLM,
26+
T5EncoderModel,
27+
)
2128

22-
from diffusers import AutoencoderKL, FlowMatchEulerDiscreteScheduler, HiDreamImageTransformer2DModel, HiDreamImagePipeline
29+
from diffusers import (
30+
AutoencoderKL,
31+
FlowMatchEulerDiscreteScheduler,
32+
HiDreamImagePipeline,
33+
HiDreamImageTransformer2DModel,
34+
)
2335
from diffusers.utils.testing_utils import (
2436
enable_full_determinism,
2537
)
@@ -89,7 +101,7 @@ def get_dummy_components(self):
89101

90102
torch.manual_seed(0)
91103
text_encoder_4 = LlamaForCausalLM.from_pretrained("hf-internal-testing/tiny-random-LlamaForCausalLM")
92-
text_encoder_4.generation_config.pad_token_id=1
104+
text_encoder_4.generation_config.pad_token_id = 1
93105
tokenizer = CLIPTokenizer.from_pretrained("hf-internal-testing/tiny-random-clip")
94106
tokenizer_2 = CLIPTokenizer.from_pretrained("hf-internal-testing/tiny-random-clip")
95107
tokenizer_3 = AutoTokenizer.from_pretrained("hf-internal-testing/tiny-random-t5")
@@ -140,10 +152,10 @@ def test_inference(self):
140152

141153
self.assertEqual(image.shape, (1, 128, 128, 3))
142154
expected_slice = np.array(
143-
[0.6253079 , 0.6115351, 0.5223988, 0.5683453, 0.44545278, 0.53524655, 0.3968956, 0.5558849, 0.5917772]
155+
[0.6253079, 0.6115351, 0.5223988, 0.5683453, 0.44545278, 0.53524655, 0.3968956, 0.5558849, 0.5917772]
144156
)
145157
max_diff = np.abs(image_slice.flatten() - expected_slice).max()
146158
self.assertLessEqual(max_diff, 1e-3, f"Got {image_slice.flatten()=}")
147159

148160
def test_inference_batch_single_identical(self):
149-
super().test_inference_batch_single_identical(expected_max_diff=3e-4)
161+
super().test_inference_batch_single_identical(expected_max_diff=3e-4)

0 commit comments

Comments
 (0)