docker improvements & changed universal device type env for different models used

This commit is contained in:
Jannik Streidl 2024-03-20 08:44:09 +01:00
parent 132d741c55
commit 1f6739337b
4 changed files with 36 additions and 19 deletions

View file

@ -21,7 +21,11 @@ from utils.utils import (
)
from utils.misc import calculate_sha256
from config import CACHE_DIR, UPLOAD_DIR, WHISPER_MODEL, WHISPER_MODEL_DIR
from config import CACHE_DIR, UPLOAD_DIR, WHISPER_MODEL, WHISPER_MODEL_DIR, DEVICE_TYPE
if DEVICE_TYPE != "cuda":
whisper_device_type = "cpu"
app = FastAPI()
app.add_middleware(
@ -56,7 +60,7 @@ def transcribe(
model = WhisperModel(
WHISPER_MODEL,
device="auto",
device=whisper_device_type,
compute_type="int8",
download_root=WHISPER_MODEL_DIR,
)