Update app.py
Browse files
app.py
CHANGED
|
@@ -10,13 +10,12 @@ from sam2.sam2_image_predictor import SAM2ImagePredictor
|
|
| 10 |
import numpy as np
|
| 11 |
from simple_lama_inpainting import SimpleLama
|
| 12 |
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
torch.backends.cudnn.allow_tf32 = True
|
| 20 |
|
| 21 |
pipe = FluxFillPipeline.from_pretrained(
|
| 22 |
"black-forest-labs/FLUX.1-Fill-dev", torch_dtype=torch.bfloat16
|
|
|
|
| 10 |
import numpy as np
|
| 11 |
from simple_lama_inpainting import SimpleLama
|
| 12 |
|
| 13 |
+
# use bfloat16 for the entire notebook
|
| 14 |
+
torch.autocast("cuda", dtype=torch.bfloat16).__enter__()
|
| 15 |
+
# turn on tfloat32 for Ampere GPUs (https://pytorch.org/docs/stable/notes/cuda.html#tensorfloat-32-tf32-on-ampere-devices)
|
| 16 |
+
if torch.cuda.get_device_properties(0).major >= 8:
|
| 17 |
+
torch.backends.cuda.matmul.allow_tf32 = True
|
| 18 |
+
torch.backends.cudnn.allow_tf32 = True
|
|
|
|
| 19 |
|
| 20 |
pipe = FluxFillPipeline.from_pretrained(
|
| 21 |
"black-forest-labs/FLUX.1-Fill-dev", torch_dtype=torch.bfloat16
|