Spaces:
Runtime error
Runtime error
updating zeroGPU
Browse files
app.py
CHANGED
@@ -50,18 +50,10 @@ dataset = load_dataset('tosin2013/autogen', streaming=True)
|
|
50 |
dataset = Dataset.from_list(list(dataset['train']))
|
51 |
|
52 |
# Check GPU availability and initialize embeddings
|
53 |
-
|
54 |
-
print("[INFO] GPU is available, using CUDA")
|
55 |
-
device = "cuda"
|
56 |
-
# Initialize CUDA device
|
57 |
-
torch.cuda.init()
|
58 |
-
else:
|
59 |
-
print("[INFO] GPU not available, using CPU")
|
60 |
-
device = "cpu"
|
61 |
-
|
62 |
embeddings = HuggingFaceEmbeddings(
|
63 |
model_name="sentence-transformers/all-MiniLM-L6-v2",
|
64 |
-
model_kwargs={"device":
|
65 |
)
|
66 |
|
67 |
# Extract texts from the dataset
|
|
|
50 |
dataset = Dataset.from_list(list(dataset['train']))
|
51 |
|
52 |
# Check GPU availability and initialize embeddings
|
53 |
+
# Use CPU for embeddings since GPU is handled by spaces.GPU decorator
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
embeddings = HuggingFaceEmbeddings(
|
55 |
model_name="sentence-transformers/all-MiniLM-L6-v2",
|
56 |
+
model_kwargs={"device": "cpu"}
|
57 |
)
|
58 |
|
59 |
# Extract texts from the dataset
|