Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
f4cb90c
1
Parent(s):
7b5450f
move to zero gpu
Browse files
utils.py
CHANGED
@@ -14,7 +14,7 @@ import os
|
|
14 |
import pickle
|
15 |
from sklearn import preprocessing
|
16 |
import json
|
17 |
-
|
18 |
|
19 |
from rdkit import RDLogger, Chem
|
20 |
# Suppress RDKit INFO messages
|
@@ -166,7 +166,7 @@ class MolecularPropertyPredictionModel():
|
|
166 |
self.base_model = AutoModelForSequenceClassification.from_pretrained(
|
167 |
"ChemFM/ChemFM-3B",
|
168 |
config=config,
|
169 |
-
device_map="
|
170 |
trust_remote_code=True,
|
171 |
token = os.environ.get("TOKEN")
|
172 |
)
|
@@ -217,6 +217,7 @@ class MolecularPropertyPredictionModel():
|
|
217 |
# handle error
|
218 |
return "error"
|
219 |
|
|
|
220 |
def predict(self, valid_df, task_type):
|
221 |
test_dataset = Dataset.from_pandas(valid_df)
|
222 |
# construct the dataloader
|
|
|
14 |
import pickle
|
15 |
from sklearn import preprocessing
|
16 |
import json
|
17 |
+
import spaces
|
18 |
|
19 |
from rdkit import RDLogger, Chem
|
20 |
# Suppress RDKit INFO messages
|
|
|
166 |
self.base_model = AutoModelForSequenceClassification.from_pretrained(
|
167 |
"ChemFM/ChemFM-3B",
|
168 |
config=config,
|
169 |
+
device_map="cuda",
|
170 |
trust_remote_code=True,
|
171 |
token = os.environ.get("TOKEN")
|
172 |
)
|
|
|
217 |
# handle error
|
218 |
return "error"
|
219 |
|
220 |
+
@spaces.GPU
|
221 |
def predict(self, valid_df, task_type):
|
222 |
test_dataset = Dataset.from_pandas(valid_df)
|
223 |
# construct the dataloader
|