menimeni123
commited on
Commit
·
47f6387
1
Parent(s):
b3aa54c
Updated handler
Browse files- handler.py +3 -4
handler.py
CHANGED
@@ -46,11 +46,10 @@ class EndpointHandler:
|
|
46 |
# Register the custom class
|
47 |
setattr(torch.nn.modules, 'BertSdpaSelfAttention', BertSdpaSelfAttention)
|
48 |
|
49 |
-
#
|
50 |
-
|
51 |
-
|
52 |
|
53 |
-
model_path = os.path.join(path, "model.joblib")
|
54 |
self.model = self.load_model(model_path)
|
55 |
self.tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')
|
56 |
self.device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
|
|
46 |
# Register the custom class
|
47 |
setattr(torch.nn.modules, 'BertSdpaSelfAttention', BertSdpaSelfAttention)
|
48 |
|
49 |
+
# Get the directory of the current script
|
50 |
+
current_dir = os.path.dirname(os.path.abspath(__file__))
|
51 |
+
model_path = os.path.join(current_dir, "model.joblib")
|
52 |
|
|
|
53 |
self.model = self.load_model(model_path)
|
54 |
self.tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')
|
55 |
self.device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|