Disty0 commited on
Commit
4e64e01
·
verified ·
1 Parent(s): a26ed32

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +9 -0
README.md CHANGED
@@ -23,8 +23,17 @@ pip install sdnq
23
  import torch
24
  import diffusers
25
  from sdnq import SDNQConfig # import sdnq to register it into diffusers and transformers
 
 
26
 
27
  pipe = diffusers.Flux2Pipeline.from_pretrained("Disty0/FLUX.2-dev-SDNQ-uint4-svd-r32", torch_dtype=torch.bfloat16)
 
 
 
 
 
 
 
28
  pipe.enable_model_cpu_offload()
29
 
30
  prompt = "Realistic macro photograph of a hermit crab using a soda can as its shell, partially emerging from the can, captured with sharp detail and natural colors, on a sunlit beach with soft shadows and a shallow depth of field, with blurred ocean waves in the background. The can has the text `BFL Diffusers` on it and it has a color gradient that start with #FF5733 at the top and transitions to #33FF57 at the bottom."
 
23
  import torch
24
  import diffusers
25
  from sdnq import SDNQConfig # import sdnq to register it into diffusers and transformers
26
+ from sdnq.common import use_torch_compile as triton_is_available
27
+ from sdnq.loader import apply_sdnq_options_to_model
28
 
29
  pipe = diffusers.Flux2Pipeline.from_pretrained("Disty0/FLUX.2-dev-SDNQ-uint4-svd-r32", torch_dtype=torch.bfloat16)
30
+
31
+ # Enable INT8 MatMul for AMD, Intel ARC and Nvidia GPUs:
32
+ if triton_is_available and (torch.cuda.is_available() or torch.xpu.is_available()):
33
+ pipe.transformer = apply_sdnq_options_to_model(pipe.transformer, use_quantized_matmul=True)
34
+ pipe.text_encoder = apply_sdnq_options_to_model(pipe.text_encoder, use_quantized_matmul=True)
35
+ pipe.transformer = torch.compile(pipe.transformer) # optional for faster speeds
36
+
37
  pipe.enable_model_cpu_offload()
38
 
39
  prompt = "Realistic macro photograph of a hermit crab using a soda can as its shell, partially emerging from the can, captured with sharp detail and natural colors, on a sunlit beach with soft shadows and a shallow depth of field, with blurred ocean waves in the background. The can has the text `BFL Diffusers` on it and it has a color gradient that start with #FF5733 at the top and transitions to #33FF57 at the bottom."