Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -24,7 +24,7 @@ torch.backends.cuda.matmul.allow_fp16_reduced_precision_reduction = False
|
|
24 |
torch.backends.cudnn.allow_tf32 = False
|
25 |
torch.backends.cudnn.deterministic = False
|
26 |
torch.backends.cudnn.benchmark = False
|
27 |
-
torch.backends.cuda.preferred_blas_library="cublas"
|
28 |
# torch.backends.cuda.preferred_linalg_library="cusolver"
|
29 |
torch.set_float32_matmul_precision("highest")
|
30 |
|
@@ -101,9 +101,9 @@ def load_and_prepare_model():
|
|
101 |
return pipe
|
102 |
|
103 |
# Preload and compile both models
|
104 |
-
pipe =load_and_prepare_model()
|
105 |
|
106 |
-
MAX_SEED = np.iinfo(np.
|
107 |
|
108 |
neg_prompt_2 = " 'non-photorealistic':1.5, 'unrealistic skin','unattractive face':1.3, 'low quality':1.1, ('dull color scheme', 'dull colors', 'digital noise':1.2),'amateurish', 'poorly drawn face':1.3, 'poorly drawn', 'distorted face', 'low resolution', 'simplistic' "
|
109 |
|
@@ -163,7 +163,7 @@ def generate_30(
|
|
163 |
progress=gr.Progress(track_tqdm=True) # Add progress as a keyword argument
|
164 |
):
|
165 |
seed = random.randint(0, MAX_SEED)
|
166 |
-
|
167 |
options = {
|
168 |
"prompt": [prompt],
|
169 |
"negative_prompt": [negative_prompt],
|
@@ -172,7 +172,7 @@ def generate_30(
|
|
172 |
"height": height,
|
173 |
"guidance_scale": guidance_scale,
|
174 |
"num_inference_steps": num_inference_steps,
|
175 |
-
|
176 |
"output_type": "pil",
|
177 |
}
|
178 |
if use_resolution_binning:
|
|
|
24 |
torch.backends.cudnn.allow_tf32 = False
|
25 |
torch.backends.cudnn.deterministic = False
|
26 |
torch.backends.cudnn.benchmark = False
|
27 |
+
#torch.backends.cuda.preferred_blas_library="cublas"
|
28 |
# torch.backends.cuda.preferred_linalg_library="cusolver"
|
29 |
torch.set_float32_matmul_precision("highest")
|
30 |
|
|
|
101 |
return pipe
|
102 |
|
103 |
# Preload and compile both models
|
104 |
+
pipe = load_and_prepare_model()
|
105 |
|
106 |
+
MAX_SEED = np.iinfo(np.int64).max
|
107 |
|
108 |
neg_prompt_2 = " 'non-photorealistic':1.5, 'unrealistic skin','unattractive face':1.3, 'low quality':1.1, ('dull color scheme', 'dull colors', 'digital noise':1.2),'amateurish', 'poorly drawn face':1.3, 'poorly drawn', 'distorted face', 'low resolution', 'simplistic' "
|
109 |
|
|
|
163 |
progress=gr.Progress(track_tqdm=True) # Add progress as a keyword argument
|
164 |
):
|
165 |
seed = random.randint(0, MAX_SEED)
|
166 |
+
generator = torch.Generator(device='cuda').manual_seed(seed)
|
167 |
options = {
|
168 |
"prompt": [prompt],
|
169 |
"negative_prompt": [negative_prompt],
|
|
|
172 |
"height": height,
|
173 |
"guidance_scale": guidance_scale,
|
174 |
"num_inference_steps": num_inference_steps,
|
175 |
+
"generator": generator,
|
176 |
"output_type": "pil",
|
177 |
}
|
178 |
if use_resolution_binning:
|