Skip to content

Commit

Permalink
Merge pull request #23 from meedan/devops-471-add-model-dir
Browse files Browse the repository at this point in the history
DEVOPS-471 add paths to allow for using new model directories
  • Loading branch information
DGaffney authored Aug 5, 2023
2 parents 50cdfbe + 33452ae commit ebb299b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/model/generic_transformer.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
from typing import Union, Dict, List
from sentence_transformers import SentenceTransformer

Expand All @@ -11,7 +12,7 @@ def __init__(self, model_name: str):
"""
self.model = None
if model_name:
self.model = SentenceTransformer(model_name)
self.model = SentenceTransformer(model_name, cache_folder=os.getenv("MODEL_DIR", "./models"))

def respond(self, docs: Union[List[schemas.Message], schemas.Message]) -> List[schemas.TextOutput]:
"""
Expand Down

0 comments on commit ebb299b

Please sign in to comment.