Update app.py
Browse files
app.py
CHANGED
|
@@ -54,7 +54,7 @@ def upload_to_ftp(filename):
|
|
| 54 |
print(f"FTP upload error: {e}")
|
| 55 |
|
| 56 |
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
| 57 |
-
torch_dtype = torch.bfloat16
|
| 58 |
|
| 59 |
checkpoint = "microsoft/Phi-3.5-mini-instruct"
|
| 60 |
#vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16)
|
|
@@ -71,7 +71,7 @@ pipe = StableDiffusion3Pipeline.from_pretrained("ford442/RealVis_Medium_1.0b_bf1
|
|
| 71 |
|
| 72 |
#pipe.scheduler.config.requires_aesthetics_score = False
|
| 73 |
#pipe.enable_model_cpu_offload()
|
| 74 |
-
|
| 75 |
#pipe.to(device=device, dtype=torch.bfloat16)
|
| 76 |
#pipe = torch.compile(pipe)
|
| 77 |
# pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config, beta_schedule="scaled_linear")
|
|
@@ -139,7 +139,7 @@ def infer(
|
|
| 139 |
#upscaler_2.to(torch.device('cpu'))
|
| 140 |
torch.set_float32_matmul_precision("highest")
|
| 141 |
seed = random.randint(0, MAX_SEED)
|
| 142 |
-
generator = torch.Generator(device='
|
| 143 |
if expanded:
|
| 144 |
system_prompt_rewrite = (
|
| 145 |
"You are an AI assistant that rewrites image prompts to be more descriptive and detailed."
|
|
|
|
| 54 |
print(f"FTP upload error: {e}")
|
| 55 |
|
| 56 |
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
| 57 |
+
#torch_dtype = torch.bfloat16
|
| 58 |
|
| 59 |
checkpoint = "microsoft/Phi-3.5-mini-instruct"
|
| 60 |
#vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16)
|
|
|
|
| 71 |
|
| 72 |
#pipe.scheduler.config.requires_aesthetics_score = False
|
| 73 |
#pipe.enable_model_cpu_offload()
|
| 74 |
+
pipe.to(device)
|
| 75 |
#pipe.to(device=device, dtype=torch.bfloat16)
|
| 76 |
#pipe = torch.compile(pipe)
|
| 77 |
# pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config, beta_schedule="scaled_linear")
|
|
|
|
| 139 |
#upscaler_2.to(torch.device('cpu'))
|
| 140 |
torch.set_float32_matmul_precision("highest")
|
| 141 |
seed = random.randint(0, MAX_SEED)
|
| 142 |
+
generator = torch.Generator(device='cpu').manual_seed(seed)
|
| 143 |
if expanded:
|
| 144 |
system_prompt_rewrite = (
|
| 145 |
"You are an AI assistant that rewrites image prompts to be more descriptive and detailed."
|