loooooong commited on
Commit
3da33ea
1 Parent(s): e27b240

add preload and jemalloc, libiomp

Browse files
Files changed (2) hide show
  1. README.md +4 -0
  2. app.py +14 -6
README.md CHANGED
@@ -8,6 +8,10 @@ sdk_version: 4.24.0
8
  app_file: app.py
9
  pinned: false
10
  license: cc-by-nc-4.0
 
 
 
 
11
  ---
12
 
13
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
8
  app_file: app.py
9
  pinned: false
10
  license: cc-by-nc-4.0
11
+ preload_from_hub:
12
+ - SG161222/Realistic_Vision_V4.0_noVAE
13
+ - stabilityai/sd-vae-ft-mse
14
+ - runwayml/stable-diffusion-v1-5 scheduler/scheduler_config.json
15
  ---
16
 
17
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py CHANGED
@@ -1,4 +1,18 @@
1
  # adapted from https://huggingface.co/spaces/HumanAIGC/OutfitAnyone/blob/main/app.py
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  import torch
3
  import spaces
4
  import gradio as gr
@@ -14,12 +28,6 @@ from diffusers import StableDiffusionPipeline
14
  from diffusers.loaders import LoraLoaderMixin
15
  import intel_extension_for_pytorch as ipex
16
 
17
- import os
18
- from os.path import join as opj
19
-
20
- token = os.getenv("ACCESS_TOKEN")
21
- os.system(f"python -m pip install git+https://{token}@github.com/logn-2024/StableGarment.git")
22
-
23
  from stablegarment.models import GarmentEncoderModel,ControlNetModel
24
  from stablegarment.piplines import StableGarmentPipeline,StableGarmentControlNetPipeline
25
 
 
1
  # adapted from https://huggingface.co/spaces/HumanAIGC/OutfitAnyone/blob/main/app.py
2
+ import os
3
+ from os.path import join as opj
4
+
5
+ LD_PRELOAD = os.getenv("LD_PRELOAD")
6
+ os.environ["LD_PRELOAD"] = f"{LD_PRELOAD}:/usr/lib/x86_64-linux-gnu/libjemalloc.so"
7
+ os.environ["MALLOC_CONF"] = "oversize_threshold:1,background_thread:true,metadata_thp:auto,dirty_decay_ms: 60000,muzzy_decay_ms:60000"
8
+
9
+ LD_PRELOAD= os.getenv("LD_PRELOAD")
10
+ os.environ["LD_PRELOAD"] = f"{LD_PRELOAD}:/usr/lib/x86_64-linux-gnu/libjemalloc.so:/usr/lib/x86_64-linux-gnu/libiomp5.so"
11
+ os.environ["OMP_NUM_THREADS"] ==32
12
+
13
+ token = os.getenv("ACCESS_TOKEN")
14
+ os.system(f"python -m pip install git+https://{token}@github.com/logn-2024/StableGarment.git")
15
+
16
  import torch
17
  import spaces
18
  import gradio as gr
 
28
  from diffusers.loaders import LoraLoaderMixin
29
  import intel_extension_for_pytorch as ipex
30
 
 
 
 
 
 
 
31
  from stablegarment.models import GarmentEncoderModel,ControlNetModel
32
  from stablegarment.piplines import StableGarmentPipeline,StableGarmentControlNetPipeline
33