VikramSingh178 commited on
Commit
8af21e8
β€’
1 Parent(s): ebbf256

Former-commit-id: 1ad46af96222172330ca4a1361e94228cdc385a4

product_diffusion_api/__pycache__/endpoints.cpython-310.pyc CHANGED
Binary files a/product_diffusion_api/__pycache__/endpoints.cpython-310.pyc and b/product_diffusion_api/__pycache__/endpoints.cpython-310.pyc differ
 
product_diffusion_api/routers/__pycache__/sdxl_text_to_image.cpython-310.pyc CHANGED
Binary files a/product_diffusion_api/routers/__pycache__/sdxl_text_to_image.cpython-310.pyc and b/product_diffusion_api/routers/__pycache__/sdxl_text_to_image.cpython-310.pyc differ
 
product_diffusion_api/routers/sdxl_text_to_image.py CHANGED
@@ -1,6 +1,4 @@
1
  import sys
2
- from torchao.quantization import apply_dynamic_quant
3
-
4
  sys.path.append("../scripts") # Path of the scripts directory
5
  import config
6
  from fastapi import APIRouter, HTTPException
@@ -16,6 +14,8 @@ from s3_manager import S3ManagerService
16
  from PIL import Image
17
  import io
18
 
 
 
19
  torch._inductor.config.conv_1x1_as_mm = True
20
  torch._inductor.config.coordinate_descent_tuning = True
21
  torch._inductor.config.epilogue_fusion = False
@@ -26,35 +26,6 @@ torch._inductor.config.use_mixed_mm = True
26
  router = APIRouter()
27
 
28
 
29
- def dynamic_quant_filter_fn(mod, *args):
30
- return (
31
- isinstance(mod, torch.nn.Linear)
32
- and mod.in_features > 16
33
- and (mod.in_features, mod.out_features)
34
- not in [
35
- (1280, 640),
36
- (1920, 1280),
37
- (1920, 640),
38
- (2048, 1280),
39
- (2048, 2560),
40
- (2560, 1280),
41
- (256, 128),
42
- (2816, 1280),
43
- (320, 640),
44
- (512, 1536),
45
- (512, 256),
46
- (512, 512),
47
- (640, 1280),
48
- (640, 1920),
49
- (640, 320),
50
- (640, 5120),
51
- (640, 640),
52
- (960, 320),
53
- (960, 640),
54
- ]
55
- )
56
-
57
-
58
 
59
 
60
 
@@ -83,18 +54,17 @@ def pil_to_s3_json(image: Image.Image,file_name) -> str:
83
 
84
  @lru_cache(maxsize=1)
85
  def load_pipeline(model_name, adapter_name,adapter_name_2):
86
- pipe = DiffusionPipeline.from_pretrained(model_name, torch_dtype=torch.bfloat16).to(
87
  "cuda"
88
  )
89
  pipe.load_lora_weights(adapter_name)
90
  pipe.load_lora_weights(adapter_name_2)
91
- pipe.set_adapters([adapter_name, adapter_name_2], adapter_weights=[0.7, 0.8])
 
92
  pipe.unload_lora_weights()
93
  pipe.unet.to(memory_format=torch.channels_last)
94
- pipe.unet = torch.compile(pipe.unet, mode="reduce-overhead", fullgraph=True)
95
  pipe.fuse_qkv_projections()
96
- #apply_dynamic_quant(pipe.unet, dynamic_quant_filter_fn)
97
- #apply_dynamic_quant(pipe.vae, dynamic_quant_filter_fn)
98
  return pipe
99
 
100
 
 
1
  import sys
 
 
2
  sys.path.append("../scripts") # Path of the scripts directory
3
  import config
4
  from fastapi import APIRouter, HTTPException
 
14
  from PIL import Image
15
  import io
16
 
17
+
18
+
19
  torch._inductor.config.conv_1x1_as_mm = True
20
  torch._inductor.config.coordinate_descent_tuning = True
21
  torch._inductor.config.epilogue_fusion = False
 
26
  router = APIRouter()
27
 
28
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
 
30
 
31
 
 
54
 
55
  @lru_cache(maxsize=1)
56
  def load_pipeline(model_name, adapter_name,adapter_name_2):
57
+ pipe = DiffusionPipeline.from_pretrained(model_name, torch_dtype= torch.bfloat16 ).to(
58
  "cuda"
59
  )
60
  pipe.load_lora_weights(adapter_name)
61
  pipe.load_lora_weights(adapter_name_2)
62
+ pipe.set_adapters([adapter_name, adapter_name_2], adapter_weights=[0.7, 0.5])
63
+ pipe.fuse_lora()
64
  pipe.unload_lora_weights()
65
  pipe.unet.to(memory_format=torch.channels_last)
66
+ pipe.unet = torch.compile(pipe.unet, mode="reduce-overhead")
67
  pipe.fuse_qkv_projections()
 
 
68
  return pipe
69
 
70
 
scripts/__pycache__/config.cpython-310.pyc CHANGED
Binary files a/scripts/__pycache__/config.cpython-310.pyc and b/scripts/__pycache__/config.cpython-310.pyc differ
 
scripts/__pycache__/utils.cpython-310.pyc ADDED
Binary file (348 Bytes). View file
 
scripts/output/README.md ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: creativeml-openrail-m
3
+ library_name: diffusers
4
+ tags:
5
+ - stable-diffusion-xl
6
+ - stable-diffusion-xl-diffusers
7
+ - text-to-image
8
+ - diffusers
9
+ - diffusers-training
10
+ base_model: stabilityai/stable-diffusion-xl-base-1.0
11
+ inference: true
12
+ ---
13
+
14
+ <!-- This model card has been generated automatically according to the information the training script had access to. You
15
+ should probably proofread and complete it, then remove this comment. -->
16
+
17
+ SDXL Product Images
18
+
19
+ ## Intended uses & limitations
20
+
21
+ #### How to use
22
+
23
+ ```python
24
+ # TODO: add an example code snippet for running this diffusion pipeline
25
+ ```
26
+
27
+ #### Limitations and bias
28
+
29
+ [TODO: provide examples of latent issues and potential remediations]
30
+
31
+ ## Training details
32
+
33
+ [TODO: describe the data used to train the model]
scripts/output/pytorch_lora_weights.safetensors.REMOVED.git-id CHANGED
@@ -1 +1 @@
1
- dd6cb78a89b6e91ebaa670d379e4ead3b73ee550
 
1
+ 55f1b147723f81304a3217185314d068b6d49439
utils.py β†’ scripts/utils.py RENAMED
File without changes
scripts/wandb/debug-internal.log CHANGED
@@ -1 +1 @@
1
- run-20240501_113730-xllytrin/logs/debug-internal.log
 
1
+ run-20240518_183749-6g8f40nj/logs/debug-internal.log
scripts/wandb/debug.log CHANGED
@@ -1 +1 @@
1
- run-20240507_154024-2j1bt71e/logs/debug.log
 
1
+ run-20240518_183749-6g8f40nj/logs/debug.log
scripts/wandb/latest-run CHANGED
@@ -1 +1 @@
1
- run-20240430_104236-lcgqwfyr
 
1
+ run-20240518_183749-6g8f40nj