feiyang-cai commited on
Commit
a3c849b
·
verified ·
1 Parent(s): 197301d

Update utils.py

Browse files
Files changed (1) hide show
  1. utils.py +3 -2
utils.py CHANGED
@@ -170,7 +170,7 @@ class MolecularPropertyPredictionModel():
170
  trust_remote_code=True,
171
  token = os.environ.get("TOKEN")
172
  )
173
- #self.base_model.to("cuda")
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
- #@spaces.GPU
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