Spaces:
Runtime error
Runtime error
Change path for config and model
Browse files
app.py
CHANGED
|
@@ -9,11 +9,14 @@ if __name__ == '__main__':
|
|
| 9 |
from utils import inference_fn, get_char_probs, get_results, get_text
|
| 10 |
import numpy as np
|
| 11 |
import gradio as gr
|
|
|
|
| 12 |
|
| 13 |
device = torch.device('cpu')
|
|
|
|
|
|
|
| 14 |
tokenizer = AutoTokenizer.from_pretrained('models_file/tokenizer')
|
| 15 |
-
model = CustomModel(CFG, config_path=
|
| 16 |
-
state = torch.load(
|
| 17 |
map_location=torch.device('cpu'))
|
| 18 |
model.load_state_dict(state['model'])
|
| 19 |
|
|
|
|
| 9 |
from utils import inference_fn, get_char_probs, get_results, get_text
|
| 10 |
import numpy as np
|
| 11 |
import gradio as gr
|
| 12 |
+
import os
|
| 13 |
|
| 14 |
device = torch.device('cpu')
|
| 15 |
+
config_path = os.path.join('models_file', 'config.pth')
|
| 16 |
+
model_path = os.path.join('models_file', 'models_file\microsoft-deberta-base_0.9449373420387531_8_best.pth')
|
| 17 |
tokenizer = AutoTokenizer.from_pretrained('models_file/tokenizer')
|
| 18 |
+
model = CustomModel(CFG, config_path=config_path, pretrained=False)
|
| 19 |
+
state = torch.load(model_path,
|
| 20 |
map_location=torch.device('cpu'))
|
| 21 |
model.load_state_dict(state['model'])
|
| 22 |
|