kastan commited on
Commit
470a4f4
Β·
1 Parent(s): ac91742

catch when no cuda device is available, fallback to CPU

Browse files
Files changed (2) hide show
  1. clip_for_ppts.py +1 -0
  2. requirements.txt +2 -2
clip_for_ppts.py CHANGED
@@ -20,6 +20,7 @@ class ClipImage:
20
  :param mode: 'image' or 'text' based on the type of input
21
  :param device: device to run the model on
22
  """
 
23
  # Path
24
  directory = 'input_features'
25
  path = os.path.join(path_to_save_image_features, directory)
 
20
  :param mode: 'image' or 'text' based on the type of input
21
  :param device: device to run the model on
22
  """
23
+ device = "cuda" if torch.cuda.is_available() else "cpu"
24
  # Path
25
  directory = 'input_features'
26
  path = os.path.join(path_to_save_image_features, directory)
requirements.txt CHANGED
@@ -5,9 +5,9 @@ sentence-transformers
5
  pandas
6
  langchain
7
  gputil
8
- git+https://github.com/openai/CLIP.git
9
  torch
10
  transformers
11
  ftfy
12
  regex
13
- tqdm
 
 
5
  pandas
6
  langchain
7
  gputil
 
8
  torch
9
  transformers
10
  ftfy
11
  regex
12
+ tqdm
13
+ git+https://github.com/openai/CLIP.git