Upload folder using huggingface_hub
Browse files- handler.py +3 -5
handler.py
CHANGED
|
@@ -3,13 +3,11 @@ import torch
|
|
| 3 |
import os
|
| 4 |
from transformers import AutoTokenizer
|
| 5 |
# Import your custom model class
|
| 6 |
-
|
| 7 |
-
# Add the local directory containing modelling_trm.py to the Python path
|
| 8 |
-
sys.path.insert(0, ".") # Assuming the handler will be in the root of the repo
|
| 9 |
from modelling_trm import TRM, TRMConfig
|
| 10 |
-
sys.path.pop(0) # Remove the path after import
|
| 11 |
|
| 12 |
-
|
|
|
|
| 13 |
def __init__(self):
|
| 14 |
self.model = None
|
| 15 |
self.tokenizer = None
|
|
|
|
| 3 |
import os
|
| 4 |
from transformers import AutoTokenizer
|
| 5 |
# Import your custom model class
|
| 6 |
+
# Assume the inference environment handles adding the repository root to the Python path
|
|
|
|
|
|
|
| 7 |
from modelling_trm import TRM, TRMConfig
|
|
|
|
| 8 |
|
| 9 |
+
|
| 10 |
+
class EndpointHandler:
|
| 11 |
def __init__(self):
|
| 12 |
self.model = None
|
| 13 |
self.tokenizer = None
|