Spaces:
Sleeping
Sleeping
Update model_utils.py
Browse filesAdd id2label as a return value in load_custom_model
- model_utils.py +1 -1
model_utils.py
CHANGED
@@ -90,7 +90,7 @@ def load_custom_model(model_dir, tokenizer_dir, id2label):
|
|
90 |
model.load_state_dict(torch.load(os.path.join(model_dir, 'pytorch_model.bin'), map_location=torch.device('cpu')))
|
91 |
tokenizer = AutoTokenizer.from_pretrained(tokenizer_dir, local_files_only = True)
|
92 |
|
93 |
-
return model, tokenizer
|
94 |
|
95 |
ner_model_dir = "./models/bilstm_ner"
|
96 |
tokenizer_dir = "./models/tokenizer"
|
|
|
90 |
model.load_state_dict(torch.load(os.path.join(model_dir, 'pytorch_model.bin'), map_location=torch.device('cpu')))
|
91 |
tokenizer = AutoTokenizer.from_pretrained(tokenizer_dir, local_files_only = True)
|
92 |
|
93 |
+
return model, tokenizer, id2label
|
94 |
|
95 |
ner_model_dir = "./models/bilstm_ner"
|
96 |
tokenizer_dir = "./models/tokenizer"
|