Spaces:
Running
on
Zero
Running
on
Zero
feiyang-cai
commited on
Update utils.py
Browse files
utils.py
CHANGED
@@ -170,7 +170,7 @@ class MolecularPropertyPredictionModel():
|
|
170 |
trust_remote_code=True,
|
171 |
token = os.environ.get("TOKEN")
|
172 |
)
|
173 |
-
#
|
174 |
|
175 |
# load the tokenizer
|
176 |
self.tokenizer = AutoTokenizer.from_pretrained(
|
@@ -199,6 +199,7 @@ class MolecularPropertyPredictionModel():
|
|
199 |
self.base_model.load_adapter(adapter_id, adapter_name=adapter_name, token = os.environ.get("TOKEN"))
|
200 |
self.apapter_scaler_path[adapter_name] = hf_hub_download(adapter_id, filename="scaler.pkl", token = os.environ.get("TOKEN"))
|
201 |
|
|
|
202 |
|
203 |
def swith_adapter(self, adapter_name, adapter_id):
|
204 |
# return flag:
|
@@ -232,7 +233,7 @@ class MolecularPropertyPredictionModel():
|
|
232 |
# handle error
|
233 |
return "error"
|
234 |
|
235 |
-
|
236 |
def predict(self, valid_df, task_type):
|
237 |
test_dataset = Dataset.from_pandas(valid_df)
|
238 |
# construct the dataloader
|
|
|
170 |
trust_remote_code=True,
|
171 |
token = os.environ.get("TOKEN")
|
172 |
)
|
173 |
+
#
|
174 |
|
175 |
# load the tokenizer
|
176 |
self.tokenizer = AutoTokenizer.from_pretrained(
|
|
|
199 |
self.base_model.load_adapter(adapter_id, adapter_name=adapter_name, token = os.environ.get("TOKEN"))
|
200 |
self.apapter_scaler_path[adapter_name] = hf_hub_download(adapter_id, filename="scaler.pkl", token = os.environ.get("TOKEN"))
|
201 |
|
202 |
+
self.base_model.to("cuda")
|
203 |
|
204 |
def swith_adapter(self, adapter_name, adapter_id):
|
205 |
# return flag:
|
|
|
233 |
# handle error
|
234 |
return "error"
|
235 |
|
236 |
+
@spaces.GPU
|
237 |
def predict(self, valid_df, task_type):
|
238 |
test_dataset = Dataset.from_pandas(valid_df)
|
239 |
# construct the dataloader
|