logo
Browse Source

Check if cuda available

Signed-off-by: junjie.jiang <junjie.jiang@zilliz.com>
main
junjie.jiang 8 months ago
parent
commit
c0f26b5975
  1. 4
      clip.py

4
clip.py

@ -96,6 +96,10 @@ class Clip(NNOperator):
def __init__(self, model_name: str, modality: str, device: str = 'cpu', checkpoint_path: str = None): def __init__(self, model_name: str, modality: str, device: str = 'cpu', checkpoint_path: str = None):
self.model_name = model_name self.model_name = model_name
self.modality = modality self.modality = modality
if not torch.cuda.is_available():
log.warning("Gpu not available, use cpu")
self.device = 'cpu'
else:
self.device = device self.device = device
self.checkpoint_path = checkpoint_path self.checkpoint_path = checkpoint_path
config = self._configs() config = self._configs()

Loading…
Cancel
Save