Spaces:
Sleeping
Sleeping
initial commit cpu only
Browse files- inference_beit.py +7 -5
- inference_resnet.py +7 -5
- inference_sam.py +15 -12
inference_beit.py
CHANGED
@@ -1,9 +1,11 @@
|
|
1 |
import tensorflow as tf
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
|
|
|
|
7 |
|
8 |
import os
|
9 |
import numpy as np
|
|
|
1 |
import tensorflow as tf
|
2 |
+
|
3 |
+
tf.config.set_visible_devices([], 'GPU')
|
4 |
+
# gpu_devices = tf.config.experimental.list_physical_devices('GPU')
|
5 |
+
# if gpu_devices:
|
6 |
+
# tf.config.experimental.set_memory_growth(gpu_devices[0], True)
|
7 |
+
# else:
|
8 |
+
# print(f"TensorFlow device: {gpu_devices}")
|
9 |
|
10 |
import os
|
11 |
import numpy as np
|
inference_resnet.py
CHANGED
@@ -1,9 +1,11 @@
|
|
1 |
import tensorflow as tf
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
|
|
|
|
7 |
|
8 |
from keras.applications import resnet
|
9 |
import tensorflow.keras.layers as L
|
|
|
1 |
import tensorflow as tf
|
2 |
+
|
3 |
+
tf.config.set_visible_devices([], 'GPU')
|
4 |
+
# gpu_devices = tf.config.experimental.list_physical_devices('GPU')
|
5 |
+
# if gpu_devices:
|
6 |
+
# tf.config.experimental.set_memory_growth(gpu_devices[0], True)
|
7 |
+
# else:
|
8 |
+
# print(f"TensorFlow device: {gpu_devices}")
|
9 |
|
10 |
from keras.applications import resnet
|
11 |
import tensorflow.keras.layers as L
|
inference_sam.py
CHANGED
@@ -1,18 +1,21 @@
|
|
1 |
import torch
|
|
|
2 |
|
3 |
-
device = torch.device("
|
4 |
-
if device.type == "cuda":
|
5 |
-
torch.cuda.set_per_process_memory_fraction(0.3, device=device.index if device.index is not None else 0)
|
6 |
-
else:
|
7 |
-
device = "cpu"
|
8 |
print(f"Torch device: {device}")
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
from segment_anything import SamPredictor, sam_model_registry
|
18 |
import matplotlib.pyplot as plt
|
|
|
1 |
import torch
|
2 |
+
import tensorflow as tf
|
3 |
|
4 |
+
device = torch.device("cpu")
|
|
|
|
|
|
|
|
|
5 |
print(f"Torch device: {device}")
|
6 |
+
# device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
7 |
+
# if device.type == "cuda":
|
8 |
+
# torch.cuda.set_per_process_memory_fraction(0.3, device=device.index if device.index is not None else 0)
|
9 |
+
# else:
|
10 |
+
# device = "cpu"
|
11 |
+
# print(f"Torch device: {device}")
|
12 |
+
|
13 |
+
tf.config.set_visible_devices([], 'GPU')
|
14 |
+
# gpu_devices = tf.config.experimental.list_physical_devices('GPU')
|
15 |
+
# if gpu_devices:
|
16 |
+
# tf.config.experimental.set_memory_growth(gpu_devices[0], True)
|
17 |
+
# else:
|
18 |
+
# print(f"TensorFlow device: {gpu_devices}")
|
19 |
|
20 |
from segment_anything import SamPredictor, sam_model_registry
|
21 |
import matplotlib.pyplot as plt
|