classify-intent / components /model_loader.py
aman-s-affinsys's picture
feat: added all the files
a6bbf63
raw
history blame
505 Bytes
from transformers import RobertaTokenizerFast, RobertaForSequenceClassification
from utils.commons import MODEL_SAVE_PATH
class ModelLoader:
def __init__(self):
self.tokenizer = None
self.model = None
def load_model(self):
"""Load model from local path"""
self.tokenizer = RobertaTokenizerFast.from_pretrained(MODEL_SAVE_PATH)
self.model = RobertaForSequenceClassification.from_pretrained(MODEL_SAVE_PATH)
return self.tokenizer, self.model