Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ def guidance_scale(self):
@property
def do_classifier_free_guidance(self):
if isinstance(self.guidance_scale, (int, float)):
return self.guidance_scale
return self.guidance_scale > 1
return self.guidance_scale.max() > 1

@property
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,22 @@ def test_xformers_attention_forwardGenerator_pass(self):
max_diff = np.abs(to_np(output_with_offload) - to_np(output_without_offload)).max()
self.assertLess(max_diff, expected_max_diff, "XFormers attention should not affect the inference results")

def test_disable_cfg(self):
components = self.get_dummy_components()
pipe = self.pipeline_class(**components)
for component in pipe.components.values():
if hasattr(component, "set_default_attn_processor"):
component.set_default_attn_processor()

pipe.to(torch_device)
pipe.set_progress_bar_config(disable=None)

generator_device = "cpu"
inputs = self.get_dummy_inputs(generator_device)
inputs["max_guidance_scale"] = 1.0
output = pipe(**inputs).frames
self.assertEqual(len(output.shape), 5)


@slow
@require_torch_gpu
Expand Down