fariedalfarizi commited on
Commit
05fd8f1
Β·
1 Parent(s): 1e0d7f9

Switch to Whisper medium model with lazy loading

Browse files
Files changed (2) hide show
  1. Dockerfile +5 -5
  2. app/config.py +1 -1
Dockerfile CHANGED
@@ -35,11 +35,11 @@ RUN python -c "from transformers import AutoTokenizer, AutoModelForSequenceClass
35
  AutoModelForSequenceClassification.from_pretrained('Cyberlace/swara-structure-model', cache_dir='/.cache'); \
36
  print('βœ… Structure Model cached!')"
37
 
38
- # 2. Download Whisper Base Model (~140MB) - lighter and faster
39
- RUN python -c "import whisper; \
40
- print('πŸ“₯ Downloading Whisper base model...'); \
41
- whisper.load_model('base', download_root='/.cache'); \
42
- print('βœ… Whisper base cached!')"
43
 
44
  # 3. Download Sentence Transformer for Keywords (~420MB)
45
  RUN python -c "from sentence_transformers import SentenceTransformer; \
 
35
  AutoModelForSequenceClassification.from_pretrained('Cyberlace/swara-structure-model', cache_dir='/.cache'); \
36
  print('βœ… Structure Model cached!')"
37
 
38
+ # 2. Whisper will be downloaded on first use (lazy loading to avoid OOM during build)
39
+ # RUN python -c "import whisper; \
40
+ # print('πŸ“₯ Downloading Whisper medium model...'); \
41
+ # whisper.load_model('medium', download_root='/.cache'); \
42
+ # print('βœ… Whisper medium cached!')"
43
 
44
  # 3. Download Sentence Transformer for Keywords (~420MB)
45
  RUN python -c "from sentence_transformers import SentenceTransformer; \
app/config.py CHANGED
@@ -31,7 +31,7 @@ class Settings(BaseSettings):
31
  UPLOAD_DIR: str = os.getenv("UPLOAD_DIR", "./uploads")
32
 
33
  # Model Configuration
34
- WHISPER_MODEL: str = os.getenv("WHISPER_MODEL", "base")
35
  KATA_KUNCI_PATH: str = os.getenv("KATA_KUNCI_PATH", "./kata_kunci.json")
36
 
37
  # Device Configuration (CPU/GPU)
 
31
  UPLOAD_DIR: str = os.getenv("UPLOAD_DIR", "./uploads")
32
 
33
  # Model Configuration
34
+ WHISPER_MODEL: str = os.getenv("WHISPER_MODEL", "medium") # Changed to medium for better accuracy
35
  KATA_KUNCI_PATH: str = os.getenv("KATA_KUNCI_PATH", "./kata_kunci.json")
36
 
37
  # Device Configuration (CPU/GPU)