AlekseyCalvin commited on
Commit
450efa9
·
verified ·
1 Parent(s): b91ec0c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -2
app.py CHANGED
@@ -51,6 +51,18 @@ device = "cuda" if torch.cuda.is_available() else "cpu"
51
 
52
  pipe.enable_model_cpu_offload()
53
 
 
 
 
 
 
 
 
 
 
 
 
 
54
 
55
  #model_id = ("zer0int/LongCLIP-GmP-ViT-L-14")
56
  #config = CLIPConfig.from_pretrained(model_id)
@@ -155,14 +167,14 @@ css = '''
155
  #title img{width: 100px; margin-right: 0.5em}
156
  #gallery .grid-wrap{height: 10vh}
157
  '''
158
- with gr.Blocks(theme=gr.themes.Soft(), css=css) as app:
159
  title = gr.HTML(
160
  """<h1><img src="https://huggingface.co/spaces/multimodalart/flux-lora-the-explorer/resolve/main/flux_lora.png" alt="LoRA"> SOONfactory </h1>""",
161
  elem_id="title",
162
  )
163
  # Info blob stating what the app is running
164
  info_blob = gr.HTML(
165
- """<div id="info_blob"> Hosted Gallery of Custom-Trained Text2Image Generative Low-Rank Adaptors (LoRAs) for FLUX models. Running On: ArtsyLite FLUX base variant. First 4 gallery rows are adapters fine-tuned for the use of RCA (Revolutionary Communists of America at [https://CommunistUSA.org/]), & other activists/artists. Below them are adapters trained on works of Soviet Avant-Garde, Dada, Surrealism, & other radical styles + some original conceptions/fusions. Under those are identity models of notable revolutionaries & poets. Click squares to switch adapters & see links to their pages, many of them offering more info/resources. </div>"""
166
  )
167
 
168
  # Info blob stating what the app is running
 
51
 
52
  pipe.enable_model_cpu_offload()
53
 
54
+ try: # A temp hack for some version diffusers lora loading problem
55
+ from diffusers.utils.peft_utils import _derive_exclude_modules
56
+
57
+ def new_derive_exclude_modules(*args, **kwargs):
58
+ exclude_modules = _derive_exclude_modules(*args, **kwargs)
59
+ if exclude_modules is not None:
60
+ exclude_modules = [n for n in exclude_modules if "proj_out" not in n]
61
+ return exclude_modules
62
+ peft_utils._derive_exclude_modules = new_derive_exclude_modules
63
+ except:
64
+ pass
65
+
66
 
67
  #model_id = ("zer0int/LongCLIP-GmP-ViT-L-14")
68
  #config = CLIPConfig.from_pretrained(model_id)
 
167
  #title img{width: 100px; margin-right: 0.5em}
168
  #gallery .grid-wrap{height: 10vh}
169
  '''
170
+ with gr.Blocks(css=css) as app:
171
  title = gr.HTML(
172
  """<h1><img src="https://huggingface.co/spaces/multimodalart/flux-lora-the-explorer/resolve/main/flux_lora.png" alt="LoRA"> SOONfactory </h1>""",
173
  elem_id="title",
174
  )
175
  # Info blob stating what the app is running
176
  info_blob = gr.HTML(
177
+ """<div id="info_blob"> Hosted Gallery of Custom-Trained Text2Image Generative Low-Rank Adaptors (LoRAs) for Z-image models. Running Over: Z.I.T. Originally set-up for adapters fine-tuned for the use of RCA (Revolutionary Communists of America at [https://CommunistUSA.org/]), & other activists/artists. We also train and feature adapters inspired by works of Soviet Avant-Garde, Dada, Surrealism, & other radical styles + some original conceptions/fusions. Under those are identity models of notable revolutionaries & poets. Click squares to switch adapters & see links to their pages, many of them offering more info/resources. </div>"""
178
  )
179
 
180
  # Info blob stating what the app is running