2023-05-11 10:06:39 -04:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
# preload the embedding model, useful for Docker images to prevent re-download on config change
|
|
|
|
# Dockerfile:
|
2023-11-10 10:34:27 -05:00
|
|
|
# ENV OPENEDAI_EMBEDDING_MODEL="sentence-transformers/all-mpnet-base-v2" # Optional
|
2023-05-11 10:06:39 -04:00
|
|
|
# RUN python3 cache_embedded_model.py
|
2023-09-15 23:11:16 -04:00
|
|
|
import os
|
|
|
|
|
|
|
|
import sentence_transformers
|
|
|
|
|
2023-11-10 10:34:27 -05:00
|
|
|
st_model = os.environ.get("OPENEDAI_EMBEDDING_MODEL", "sentence-transformers/all-mpnet-base-v2")
|
2023-05-11 10:06:39 -04:00
|
|
|
model = sentence_transformers.SentenceTransformer(st_model)
|