wondervictor commited on
Commit
f06103e
1 Parent(s): 7dcb45e

add accelerate

Browse files
.DS_Store CHANGED
Binary files a/.DS_Store and b/.DS_Store differ
 
app.py CHANGED
@@ -5,6 +5,7 @@ from transformers import AutoTokenizer
5
  import torch
6
  import numpy as np
7
  import sys
 
8
 
9
  version = "YxZhang/evf-sam"
10
  model_type = "ori"
@@ -19,9 +20,10 @@ kwargs = {
19
  "torch_dtype": torch.half,
20
  }
21
  model = EvfSamModel.from_pretrained(version, low_cpu_mem_usage=True,
22
- **kwargs).cuda().eval()
23
-
24
 
 
25
  @torch.no_grad()
26
  def pred(image_np, prompt):
27
  original_size_list = [image_np.shape[:2]]
 
5
  import torch
6
  import numpy as np
7
  import sys
8
+ import spaces
9
 
10
  version = "YxZhang/evf-sam"
11
  model_type = "ori"
 
20
  "torch_dtype": torch.half,
21
  }
22
  model = EvfSamModel.from_pretrained(version, low_cpu_mem_usage=True,
23
+ **kwargs).eval()
24
+ model.to('cuda')
25
 
26
+ @spaces.GPU
27
  @torch.no_grad()
28
  def pred(image_np, prompt):
29
  original_size_list = [image_np.shape[:2]]
assets/architecture.jpg ADDED
assets/bus.jpg ADDED
assets/bus_vis.png ADDED
assets/carrots.jpg ADDED
assets/carrots_vis.png ADDED
assets/food.jpg ADDED
assets/food_vis.png ADDED
assets/logo.jpg ADDED
assets/pizza.jpg ADDED
assets/pizza_vis.png ADDED
assets/zebra.jpg ADDED
assets/zebra_vis.png ADDED
requirements.txt CHANGED
@@ -1,5 +1,5 @@
1
  packaging
2
- accelerate
3
  sentencepiece
4
  einops==0.4.1
5
  fastapi==0.100.1
 
1
  packaging
2
+ accelerate==0.25.0
3
  sentencepiece
4
  einops==0.4.1
5
  fastapi==0.100.1