Skip to content

Commit 0be8d15

Browse files
authored
Avoid crashing if tensorflow is not installed for VTAB (#131)
1 parent 193253c commit 0be8d15

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

clip_benchmark/datasets/tfds.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@ def download_tfds_dataset(name, data_dir=None):
99
builder.download_and_prepare()
1010

1111
def disable_gpus_on_tensorflow():
12-
import tensorflow as tf
13-
tf.config.set_visible_devices([], 'GPU')
12+
try:
13+
import tensorflow as tf
14+
tf.config.set_visible_devices([], 'GPU')
15+
except ImportError:
16+
pass
1417

1518
class VTABIterableDataset(torch.utils.data.IterableDataset):
1619

0 commit comments

Comments
 (0)