tosin2013 commited on
Commit
71875a9
·
1 Parent(s): b0b776a

updating zeroGPU

Browse files
Files changed (1) hide show
  1. app.py +2 -10
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
- if torch.cuda.is_available():
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": 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