diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2393d91 --- /dev/null +++ b/.gitignore @@ -0,0 +1,25 @@ +# Python cache +__pycache__/ +*.py[cod] +*$py.class + +# Virtual environments +venv/ +env/ +ENV/ + +# IDE +.vscode/ +.idea/ +*.swp +*.swo +*~ + +# OS +.DS_Store +Thumbs.db + +# Build artifacts +dist/ +build/ +*.egg-info/ diff --git a/src/_LocalTranscribe.py b/src/_LocalTranscribe.py index 5d78562..adf1025 100644 --- a/src/_LocalTranscribe.py +++ b/src/_LocalTranscribe.py @@ -40,16 +40,19 @@ def transcribe(path, glob_file, model=None, language=None, verbose=False): within the specified path. """ - # Check for GPU acceleration + # Check for GPU acceleration and set device if backends.mps.is_available(): + device = 'mps' Generator('mps').manual_seed(42) elif cuda.is_available(): + device = 'cuda' Generator('cuda').manual_seed(42) else: + device = 'cpu' Generator().manual_seed(42) - # Load model - model = whisper.load_model(model) + # Load model on the correct device + model = whisper.load_model(model, device=device) # Start main loop files_transcripted=[] for file in glob_file: diff --git a/src/__pycache__/_LocalTranscribe.cpython-310.pyc b/src/__pycache__/_LocalTranscribe.cpython-310.pyc deleted file mode 100644 index 1c513b0..0000000 Binary files a/src/__pycache__/_LocalTranscribe.cpython-310.pyc and /dev/null differ