mozilla / DSAlign

DeepSpeech based forced alignment tool
Mozilla Public License 2.0
235 stars 33 forks source link

Alphabet is not defined despite being loaded. #36

Open ArEnSc opened 4 years ago

ArEnSc commented 4 years ago

Ran a small example it doesn't produce the align.json file.

"""
Traceback (most recent call last):
  File "/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "/Users/raisintoastllc/MachineLearning/Projects/SpeechSynthesis/DataProcessing/DSAlign/align/align.py", line 85, in align
    tc = read_script(script)
  File "/Users/raisintoastllc/MachineLearning/Projects/SpeechSynthesis/DataProcessing/DSAlign/align/align.py", line 47, in read_script
    tc = TextCleaner(alphabet,
NameError: name 'alphabet' is not defined
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/raisintoastllc/MachineLearning/Projects/SpeechSynthesis/DataProcessing/DSAlign/align/align.py", line 682, in <module>
    main()
  File "/Users/raisintoastllc/MachineLearning/Projects/SpeechSynthesis/DataProcessing/DSAlign/align/align.py", line 521, in main
    for aligned_file, file_total_fragments, file_dropped_fragments, file_reasons in \
  File "/Users/raisintoastllc/MachineLearning/Projects/SpeechSynthesis/DataProcessing/DSAlign/align/utils.py", line 73, in log_progress
    for global_step, obj in enumerate(it, 1):
  File "/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/pool.py", line 868, in next
    raise value
NameError: name 'alphabet' is not defined
ArEnSc commented 4 years ago
def align(triple):
    tlog, script, aligned = triple
    args = parse_args() <-- add this here

args = parse_args() <-- hard code here
    alphabet = Alphabet("/Users//MachineLearning/Projects/SpeechSynthesis/DataProcessing/DSAlign/models/en/alphabet.txt") <-- hard code here
    tc = TextCleaner(alphabet,
                     dashes_to_ws=not args.text_keep_dashes,
                     normalize_space=not args.text_keep_ws,
                     to_lower=not args.text_keep_casing)

That fixes it mostly