Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update DeepSpeech.py #3779

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 21 additions & 3 deletions DeepSpeech.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,29 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function

if __name__ == '__main__':
import sys
import subprocess

def check_training_package():
try:
import deepspeech_training # Check if the training package is installed
return True
except ImportError:
return False

def run_training():
try:
from deepspeech_training import train as ds_train
ds_train.run_script() # Run the DeepSpeech training script
except ImportError:
print('Training package is not installed. See training documentation.')
raise
except Exception as e:
print(f'An error occurred during training: {e}')

if __name__ == '__main__':
if not check_training_package():
print('DeepSpeech training package is not installed.')
print('Please install it by following the training documentation.')
sys.exit(1)

ds_train.run_script()
run_training()