0llheaven commited on
Commit
354e822
·
verified ·
1 Parent(s): 70ce441

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -18,16 +18,16 @@ model = AutoModelForImageTextToText.from_pretrained(
18
  model_id,
19
  # load_in_4bit=True,
20
  torch_dtype=torch.float32 if device.type == "cpu" else torch.bfloat16,
21
- device_map="auto" if device.type == "cuda" else None,
22
  ).to(device)
23
 
24
- if device.type == "cuda":
25
- model.gradient_checkpointing_enable()
26
- # model.gradient_checkpointing_enable()
27
 
28
  processor = AutoProcessor.from_pretrained(model_id)
29
 
30
- @spaces.GPU(duration=120)
31
  # Function to process the image and generate the description
32
  def generate_description(image: Image.Image, instruction: str):
33
 
 
18
  model_id,
19
  # load_in_4bit=True,
20
  torch_dtype=torch.float32 if device.type == "cpu" else torch.bfloat16,
21
+ device_map=device,
22
  ).to(device)
23
 
24
+ # if device.type == "cuda":
25
+ # model.gradient_checkpointing_enable()
26
+ model.gradient_checkpointing_enable()
27
 
28
  processor = AutoProcessor.from_pretrained(model_id)
29
 
30
+ # @spaces.GPU(duration=120)
31
  # Function to process the image and generate the description
32
  def generate_description(image: Image.Image, instruction: str):
33