mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-11-25 01:09:22 +01:00
13 lines
482 B
Python
13 lines
482 B
Python
#!/usr/bin/env python3
|
|
# preload the embedding model, useful for Docker images to prevent re-download on config change
|
|
# Dockerfile:
|
|
# ENV OPENEDAI_EMBEDDING_MODEL=all-mpnet-base-v2 # Optional
|
|
# RUN python3 cache_embedded_model.py
|
|
import os
|
|
|
|
import sentence_transformers
|
|
from extensions.openai.script import params
|
|
|
|
st_model = os.environ.get("OPENEDAI_EMBEDDING_MODEL", params.get('embedding_model', 'all-mpnet-base-v2'))
|
|
model = sentence_transformers.SentenceTransformer(st_model)
|