ソースを参照

Valider CUDA au demarrage et utiliser la GTX 1050 Ti

Andy Esnard 13 時間 前
親
コミット
f47946c33c
3 ファイル変更、6 行追加、1 行削除
  1. 2 0
      app.py
  2. 3 0
      openshift-deployment-patch.json
  3. 1 1
      requirements.txt

+ 2 - 0
app.py

@@ -39,6 +39,8 @@ app = FastAPI()
 # Whisper model (shared)
 # =========================
 model = WhisperModel(MODEL_SIZE, device="cuda", compute_type="float32")
+# Vérifier les kernels CUDA avant de déclarer le service prêt.
+list(model.transcribe(np.zeros(16000, dtype=np.float32), language="fr", beam_size=1)[0])
 model_lock = Lock()
 
 def transcribe_audio(audio):

+ 3 - 0
openshift-deployment-patch.json

@@ -1,8 +1,11 @@
 [
   {"op":"test","path":"/spec/template/spec/containers/0/name","value":"whisper-stt-chatbot"},
+  {"op":"add","path":"/metadata/annotations/image.openshift.io~1triggers","value":"[{\"from\":{\"kind\":\"ImageStreamTag\",\"name\":\"whisper-stt-chatbot:latest\",\"namespace\":\"localai\"},\"fieldPath\":\"spec.template.spec.containers[?(@.name==\\\"whisper-stt-chatbot\\\")].image\",\"paused\":true}]"},
   {"op":"replace","path":"/spec/replicas","value":1},
+  {"op":"replace","path":"/spec/template/spec/containers/0/image","value":"image-registry.openshift-image-registry.svc:5000/localai/whisper-stt-chatbot@sha256:3c79e8d40bb63e912519e7017d7091520fcebcb4928023d5a902206d26ba7d0e"},
   {"op":"add","path":"/spec/template/spec/serviceAccountName","value":"whisper-stt-chatbot"},
   {"op":"add","path":"/spec/template/spec/automountServiceAccountToken","value":false},
+  {"op":"replace","path":"/spec/template/spec/affinity/nodeAffinity/requiredDuringSchedulingIgnoredDuringExecution/nodeSelectorTerms/0/matchExpressions/0/values","value":["chambre.local.pentou.ovh"]},
   {"op":"add","path":"/spec/strategy","value":{"type":"Recreate"}},
   {"op":"replace","path":"/spec/template/spec/containers/0/resources","value":{"limits":{"nvidia.com/gpu":"1"}}},
   {"op":"replace","path":"/spec/template/spec/volumes","value":[{"name":"hf-cache","persistentVolumeClaim":{"claimName":"whisper-model-cache"}}]},

+ 1 - 1
requirements.txt

@@ -1,7 +1,7 @@
 fastapi==0.162.0
 uvicorn[standard]==0.54.0
 faster-whisper==1.2.1
-# CUDA 12 / cuDNN 8 de l'image, compatible avec les GPU Maxwell/Pascal.
+# CUDA 12 / cuDNN 8 de l'image.
 ctranslate2==4.4.0
 numpy<3
 python-multipart==0.0.32