Spaces:
Runtime error
Runtime error
Update src/flux/xflux_pipeline.py
Browse files
src/flux/xflux_pipeline.py
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
from PIL import Image, ExifTags
|
2 |
import numpy as np
|
3 |
import torch
|
@@ -34,6 +36,7 @@ import spaces
|
|
34 |
|
35 |
class XFluxPipeline:
|
36 |
def __init__(self, model_type, device, offload: bool = False):
|
|
|
37 |
self.device = torch.device(device)
|
38 |
self.offload = offload
|
39 |
self.model_type = model_type
|
@@ -162,7 +165,6 @@ class XFluxPipeline:
|
|
162 |
image_proj = self.improj(image_prompt_embeds)
|
163 |
return image_proj
|
164 |
|
165 |
-
@spaces.GPU()
|
166 |
def __call__(self,
|
167 |
prompt: str,
|
168 |
image_prompt: Image = None,
|
@@ -219,6 +221,7 @@ class XFluxPipeline:
|
|
219 |
neg_ip_scale=neg_ip_scale,
|
220 |
)
|
221 |
|
|
|
222 |
def gradio_generate(self, prompt, image_prompt, controlnet_image, width, height, guidance,
|
223 |
num_steps, seed, true_gs, ip_scale, neg_ip_scale, neg_prompt,
|
224 |
neg_image_prompt, timestep_to_start_cfg, control_type, control_weight,
|
|
|
1 |
+
import torch.multiprocessing as mp
|
2 |
+
|
3 |
from PIL import Image, ExifTags
|
4 |
import numpy as np
|
5 |
import torch
|
|
|
36 |
|
37 |
class XFluxPipeline:
|
38 |
def __init__(self, model_type, device, offload: bool = False):
|
39 |
+
mp.set_start_method('spawn', force=True)
|
40 |
self.device = torch.device(device)
|
41 |
self.offload = offload
|
42 |
self.model_type = model_type
|
|
|
165 |
image_proj = self.improj(image_prompt_embeds)
|
166 |
return image_proj
|
167 |
|
|
|
168 |
def __call__(self,
|
169 |
prompt: str,
|
170 |
image_prompt: Image = None,
|
|
|
221 |
neg_ip_scale=neg_ip_scale,
|
222 |
)
|
223 |
|
224 |
+
@spaces.GPU()
|
225 |
def gradio_generate(self, prompt, image_prompt, controlnet_image, width, height, guidance,
|
226 |
num_steps, seed, true_gs, ip_scale, neg_ip_scale, neg_prompt,
|
227 |
neg_image_prompt, timestep_to_start_cfg, control_type, control_weight,
|