Spaces:
Sleeping
Sleeping
from transformers import RobertaTokenizerFast, RobertaForSequenceClassification | |
from utils.commons import HUGGINGFACE_MODEL_PATH, MODEL_SAVE_PATH | |
import os | |
class ModelIngestor: | |
def download_model(): | |
"""Download and save the model""" | |
if not os.path.exists(MODEL_SAVE_PATH): | |
os.makedirs(MODEL_SAVE_PATH) | |
RobertaTokenizerFast.from_pretrained(HUGGINGFACE_MODEL_PATH).save_pretrained(MODEL_SAVE_PATH) | |
RobertaForSequenceClassification.from_pretrained(HUGGINGFACE_MODEL_PATH).save_pretrained(MODEL_SAVE_PATH) | |
print(f"Model saved to {MODEL_SAVE_PATH}") |