whisper_wrapper / lib /config.py
Madhuslista's picture
Refactor: Move device definitions to config file
66b630d
raw
history blame
823 Bytes
#!/usr/bin/python
# -*- coding: utf-8 -*-
from pathlib import Path
import torch
# -->> Tunables <<---------------------
# -->> Definitions <<------------------
# Repository root directory
ROOT_DIR = Path(__file__).resolve().parent.parent
# Media folder
MEDIA_DIR = ROOT_DIR / "RESULTS" / "Media"
# Media subfolders
AUDIO_DIR = MEDIA_DIR / "Audios"
VIDEOS_DIR = MEDIA_DIR / "Videos"
TRANSCRIPTS_DIR = MEDIA_DIR / "Transcriptions"
# File extensions
AUDIO_EXT = ".mp3"
TEXT_EXT = ".txt"
# Model parameters
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
BATCH_SIZE = 16
if DEVICE == "cuda":
COMPUTE_TYPE = "float16"
else:
COMPUTE_TYPE = "int8"
print("Using device:", DEVICE)
# -->> API <<--------------------------
# -->> Execute <<----------------------
# -->> Export <<-----------------------