Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -33,7 +33,6 @@ torch.backends.cudnn.deterministic = False
|
|
33 |
#torch.backends.cudnn.benchmark = False
|
34 |
torch.backends.cuda.preferred_blas_library="cublas"
|
35 |
#torch.backends.cuda.preferred_linalg_library="cusolver"
|
36 |
-
torch.set_float32_matmul_precision("highest")
|
37 |
|
38 |
hftoken = os.getenv("HF_AUTH_TOKEN")
|
39 |
|
@@ -133,6 +132,7 @@ def infer(
|
|
133 |
latent_file, # Add latents file input
|
134 |
progress=gr.Progress(track_tqdm=True),
|
135 |
):
|
|
|
136 |
seed = random.randint(0, MAX_SEED)
|
137 |
generator = torch.Generator(device='cuda').manual_seed(seed)
|
138 |
if expanded:
|
@@ -267,7 +267,7 @@ def infer(
|
|
267 |
refine.save(refine_path,optimize=False,compress_level=0)
|
268 |
upload_to_ftp(refine_path)
|
269 |
with torch.no_grad():
|
270 |
-
upscale2 = upscaler_2(
|
271 |
print('-- got upscaled image --')
|
272 |
downscale2 = upscale2.resize((upscale2.width // 4, upscale2.height // 4),Image.LANCZOS)
|
273 |
upscale_path = f"sd35_upscale_{seed}.png"
|
|
|
33 |
#torch.backends.cudnn.benchmark = False
|
34 |
torch.backends.cuda.preferred_blas_library="cublas"
|
35 |
#torch.backends.cuda.preferred_linalg_library="cusolver"
|
|
|
36 |
|
37 |
hftoken = os.getenv("HF_AUTH_TOKEN")
|
38 |
|
|
|
132 |
latent_file, # Add latents file input
|
133 |
progress=gr.Progress(track_tqdm=True),
|
134 |
):
|
135 |
+
torch.set_float32_matmul_precision("highest")
|
136 |
seed = random.randint(0, MAX_SEED)
|
137 |
generator = torch.Generator(device='cuda').manual_seed(seed)
|
138 |
if expanded:
|
|
|
267 |
refine.save(refine_path,optimize=False,compress_level=0)
|
268 |
upload_to_ftp(refine_path)
|
269 |
with torch.no_grad():
|
270 |
+
upscale2 = upscaler_2(refine, tiling=True, tile_width=1024, tile_height=1024)
|
271 |
print('-- got upscaled image --')
|
272 |
downscale2 = upscale2.resize((upscale2.width // 4, upscale2.height // 4),Image.LANCZOS)
|
273 |
upscale_path = f"sd35_upscale_{seed}.png"
|