SkalskiP commited on
Commit
c602aa4
·
1 Parent(s): bf673e1
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -24,12 +24,12 @@ for taking it to the next level by enabling inpainting with the FLUX.
24
  MAX_SEED = np.iinfo(np.int32).max
25
  IMAGE_SIZE = 1024
26
  # DEVICE = torch.device("cuda" if torch.cuda.is_available() else "cpu")
27
- DEVICE = torch.device("cpu")
28
 
29
- # torch.autocast(device_type="cuda", dtype=torch.bfloat16).__enter__()
30
- # if torch.cuda.get_device_properties(0).major >= 8:
31
- # torch.backends.cuda.matmul.allow_tf32 = True
32
- # torch.backends.cudnn.allow_tf32 = True
33
 
34
  FLORENCE_MODEL, FLORENCE_PROCESSOR = load_florence_model(device=DEVICE)
35
  SAM_IMAGE_MODEL = load_sam_image_model(device=DEVICE)
@@ -65,7 +65,7 @@ def is_image_empty(image: Image.Image) -> bool:
65
 
66
  @spaces.GPU()
67
  @torch.inference_mode()
68
- # @torch.autocast(device_type="cuda", dtype=torch.bfloat16)
69
  def process(
70
  input_image_editor: dict,
71
  inpainting_prompt_text: str,
 
24
  MAX_SEED = np.iinfo(np.int32).max
25
  IMAGE_SIZE = 1024
26
  # DEVICE = torch.device("cuda" if torch.cuda.is_available() else "cpu")
27
+ DEVICE = torch.device("cuda")
28
 
29
+ torch.autocast(device_type="cuda", dtype=torch.bfloat16).__enter__()
30
+ if torch.cuda.get_device_properties(0).major >= 8:
31
+ torch.backends.cuda.matmul.allow_tf32 = True
32
+ torch.backends.cudnn.allow_tf32 = True
33
 
34
  FLORENCE_MODEL, FLORENCE_PROCESSOR = load_florence_model(device=DEVICE)
35
  SAM_IMAGE_MODEL = load_sam_image_model(device=DEVICE)
 
65
 
66
  @spaces.GPU()
67
  @torch.inference_mode()
68
+ @torch.autocast(device_type="cuda", dtype=torch.bfloat16)
69
  def process(
70
  input_image_editor: dict,
71
  inpainting_prompt_text: str,