Spaces:
Runtime error
Runtime error
Update src/run.py
Browse files- src/run.py +9 -9
src/run.py
CHANGED
|
@@ -49,10 +49,10 @@ class NLP_classification():
|
|
| 49 |
|
| 50 |
def training(self, epochs=50, batch_size=4, lr=1e-5, dropout=0.1, data_cut=None, early_stop_count=10,
|
| 51 |
wandb_log=False, wandb_project=None, wandb_group=None, wandb_name=None, wandb_memo=None):
|
| 52 |
-
os.environ["CUDA_VISIBLE_DEVICES"]= "{0}".format(int(self.gpu_num))
|
| 53 |
-
|
| 54 |
-
device = torch.device('cuda:{0}'.format(int(self.gpu_num)))
|
| 55 |
-
torch.cuda.set_device(device)
|
| 56 |
set_seed(self.random_state)
|
| 57 |
torch.set_num_threads(10)
|
| 58 |
|
|
@@ -149,7 +149,7 @@ class NLP_classification():
|
|
| 149 |
|
| 150 |
|
| 151 |
def prediction(self, selected_model=None, batch_size=8):
|
| 152 |
-
os.environ["CUDA_VISIBLE_DEVICES"]= "{0}".format(int(self.gpu_num))
|
| 153 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
| 154 |
set_seed(self.random_state)
|
| 155 |
torch.set_num_threads(10)
|
|
@@ -192,10 +192,10 @@ class NLP_classification():
|
|
| 192 |
|
| 193 |
|
| 194 |
def get_embedding(self, selected_model=None, batch_size=8, return_hidden=True, return_hidden_pretrained=False):
|
| 195 |
-
os.environ["CUDA_VISIBLE_DEVICES"]= "{0}".format(int(self.gpu_num))
|
| 196 |
-
|
| 197 |
-
device = torch.device('cuda:{0}'.format(int(self.gpu_num)))
|
| 198 |
-
torch.cuda.set_device(device)
|
| 199 |
set_seed(self.random_state)
|
| 200 |
torch.set_num_threads(10)
|
| 201 |
task_type=self.task_type
|
|
|
|
| 49 |
|
| 50 |
def training(self, epochs=50, batch_size=4, lr=1e-5, dropout=0.1, data_cut=None, early_stop_count=10,
|
| 51 |
wandb_log=False, wandb_project=None, wandb_group=None, wandb_name=None, wandb_memo=None):
|
| 52 |
+
#os.environ["CUDA_VISIBLE_DEVICES"]= "{0}".format(int(self.gpu_num))
|
| 53 |
+
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
| 54 |
+
#device = torch.device('cuda:{0}'.format(int(self.gpu_num)))
|
| 55 |
+
#torch.cuda.set_device(device)
|
| 56 |
set_seed(self.random_state)
|
| 57 |
torch.set_num_threads(10)
|
| 58 |
|
|
|
|
| 149 |
|
| 150 |
|
| 151 |
def prediction(self, selected_model=None, batch_size=8):
|
| 152 |
+
#os.environ["CUDA_VISIBLE_DEVICES"]= "{0}".format(int(self.gpu_num))
|
| 153 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
| 154 |
set_seed(self.random_state)
|
| 155 |
torch.set_num_threads(10)
|
|
|
|
| 192 |
|
| 193 |
|
| 194 |
def get_embedding(self, selected_model=None, batch_size=8, return_hidden=True, return_hidden_pretrained=False):
|
| 195 |
+
#os.environ["CUDA_VISIBLE_DEVICES"]= "{0}".format(int(self.gpu_num))
|
| 196 |
+
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
| 197 |
+
#device = torch.device('cuda:{0}'.format(int(self.gpu_num)))
|
| 198 |
+
#torch.cuda.set_device(device)
|
| 199 |
set_seed(self.random_state)
|
| 200 |
torch.set_num_threads(10)
|
| 201 |
task_type=self.task_type
|