Spaces:
Runtime error
Runtime error
Commit ·
cabed47
1
Parent(s): 943e5d4
Upload 8 files
Browse files- common/model_manager.py +3 -3
common/model_manager.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
Author: Qiguang Chen
|
| 3 |
Date: 2023-01-11 10:39:26
|
| 4 |
LastEditors: Qiguang Chen
|
| 5 |
-
LastEditTime: 2023-02-08
|
| 6 |
Description: manage all process of model training and prediction.
|
| 7 |
|
| 8 |
'''
|
|
@@ -287,8 +287,8 @@ class ModelManager(object):
|
|
| 287 |
return outputs, res
|
| 288 |
|
| 289 |
def load(self):
|
| 290 |
-
|
| 291 |
-
self.model = torch.load(os.path.join(self.config.base["model_dir"], "model.pkl"),map_location=torch.device(
|
| 292 |
if self.config.tokenizer["_tokenizer_name_"] == "word_tokenizer":
|
| 293 |
self.tokenizer = get_tokenizer_class(self.config.tokenizer["_tokenizer_name_"]).from_file(
|
| 294 |
os.path.join(self.config.base["model_dir"], "tokenizer.json"))
|
|
|
|
| 2 |
Author: Qiguang Chen
|
| 3 |
Date: 2023-01-11 10:39:26
|
| 4 |
LastEditors: Qiguang Chen
|
| 5 |
+
LastEditTime: 2023-02-08 01:02:20
|
| 6 |
Description: manage all process of model training and prediction.
|
| 7 |
|
| 8 |
'''
|
|
|
|
| 287 |
return outputs, res
|
| 288 |
|
| 289 |
def load(self):
|
| 290 |
+
# self.model = torch.load(os.path.join(self.config.base["model_dir"], "model.pkl"), map_location=torch.device(self.device))
|
| 291 |
+
self.model = torch.load(os.path.join(self.config.base["model_dir"], "model.pkl"), map_location=torch.device("cpu"))
|
| 292 |
if self.config.tokenizer["_tokenizer_name_"] == "word_tokenizer":
|
| 293 |
self.tokenizer = get_tokenizer_class(self.config.tokenizer["_tokenizer_name_"]).from_file(
|
| 294 |
os.path.join(self.config.base["model_dir"], "tokenizer.json"))
|