Error: __init__() missing 1 required positional argument: 'alphabet'

When i train a new model i get the following Error:

I FINISHED optimization in 0:01:49.846611
Traceback (most recent call last):
File “DeepSpeech.py”, line 969, in
absl.app.run(main)
File “/home/shadi/.local/lib/python3.7/site-packages/absl/app.py”, line 299, in run
_run_main(main, args)
File “/home/shadi/.local/lib/python3.7/site-packages/absl/app.py”, line 250, in _run_main
sys.exit(main(argv))
File “DeepSpeech.py”, line 946, in main
test()
File “DeepSpeech.py”, line 685, in test
samples = evaluate(FLAGS.test_files.split(’,’), create_model, try_loading)
File “/home/shadi/Desktop/DeepSpeech/evaluate.py”, line 47, in evaluate
FLAGS.scorer_path, Config.alphabet)
TypeError: init() missing 1 required positional argument: ‘alphabet’

My bash Running file :

python3 -u DeepSpeech.py
–train_files /home/shadi/Desktop/DeepSpeech/data/jarvis/train/train.csv
–dev_files /home/shadi/Desktop/DeepSpeech/data/jarvis/dev/dev.csv
–test_files /home/shadi/Desktop/DeepSpeech/data/jarvis/test/test.csv
–automatic_mixed_precision=True
–n_hidden 375
–export_tflite
–export_dir /home/shadi/Desktop/DeepSpeech/data/jarvis/results/model_export/
–checkpoint_dir /home/shadi/Desktop/DeepSpeech/data/jarvis/results/checkout/
–alphabet_config_path /home/shadi/Desktop/DeepSpeech/data/alphabet.txt
“$@”

Any Idea what this means or how to fix it?
Thanks to everyone
Best Regards
Shadi.

I’m not a great python developer, but shouldn’t arguments passed by a double -? Like

--alphabet_config_path

And check that the path is correct and the file is there.

I am passing the falgs with a double " – "
It’s just that the text here on this forum shows it like that

Can you verify using ds_ctcdecoder installed from https://community-tc.services.mozilla.com/tasks/ZSWB9IAuS4OULjCuMXwg9g#artifacts (use matching python version obviously).

1 Like

Try moving it up in your call, for mixed precision you set True, for tflite you don’t, your paths have a / at the end. I am no expert for parameters, so try moving it around. The parameters should be fine. Maybe leave out all but the essential flags for your first run.

@Shadi_Shakkour Please also document what version you are working on.

I thank you all for your replys I will do so when im home
Your help is much appreciated

Best of regards
Shadi.

Requirement already satisfied: ds_ctcdecoder in /home/shadi/.local/lib/python3.7/site-packages (0.7.0a1)
Requirement already satisfied: numpy>=1.14.5 in /home/shadi/.local/lib/python3.7/site-packages (from ds_ctcdecoder) (1.18.1)

@lissyx
@othiele

pip install - - upgrade. Please upgrade to 0.7.0a2 that was just released

Same error here as well.
This could be because of version mismatch between DeepSpeech and ds_ctcdecoder.

evaluate.py calls Scorer as follows
def evaluate(test_csvs, create_model, try_loading):
if FLAGS.scorer_path:
scorer = Scorer(FLAGS.lm_alpha, FLAGS.lm_beta,
FLAGS.scorer_path, Config.alphabet)

However source code of ds_ctcdecoder shows that init() of Scorer needs 4 arguments.

class Scorer(swigwrapper.Scorer):
    """Wrapper for Scorer.

    :param alpha: Language model weight.
    :type alpha: float
    :param beta: Word insertion bonus.
    :type beta: float
    :model_path: Path to load language model.
    :trie_path: Path to trie file.
    :alphabet: Alphabet
    :type model_path: basestring
    """

    def __init__(self, alpha, beta, model_path, trie_path, alphabet):
        super(Scorer, self).__init__()

Is there any way to install a previous version of ds_ctcdecoder ?
The version I’m using currently is 0.7.0-alpha.1

Thanks

if you use an older deepspeech checkout, and follo the docs to install it, then it will downgrade.

i have done that and im currently trying again.

i thank you again for you reply and much appreciated help :slight_smile: .

This did not help or change anything the output was still the same

i thank you for you reply :slight_smile: .
Best Regards

If you are just starting with DeepSpeech, just install 0.6 version in a virtual environment and go on from there. Latest builds can have issues, but the 0.6 works fine. Fine a running basic config and change parameters later.

I will try on Version 0.6.1

i thank you again for you reply
Best Regards

ive tried with version 0.6.1
and i get the following error

Instructions for updating:
Use standard file APIs to delete files with this prefix.
W0219 15:20:36.589558 139973126850368 deprecation.py:323] From /home/shadi/.local/lib/python3.7/site-packages/tensorflow/python/training/saver.py:960: remove_checkpoint (from tensorflow.python.training.checkpoint_management) is deprecated and will be removed in a future version.
Instructions for updating:
Use standard file APIs to delete files with this prefix.
Epoch 5 | Validation | Elapsed Time: 0:00:07 | Steps: 1 | Loss: 176.848511 | Dataset: /home/shadi/Desktop/DeepSpeech-0.6.1/data/jarvis/train/train.csv
I Early stop triggered as (for last 4 steps) validation loss: 176.848511 with standard deviation: 13.728871 and mean: 159.063858
I FINISHED optimization in 0:14:44.315500
[scorer.cpp:77] FATAL: "(access(filename, 4)) == (0)" check failed. Invalid language model path

@othiele
@lissyx
i thanky you all for your help

I guess the error is explicit enough ?

ohhh Right i didnt notice since i downgraded to 0.6.1
i applogize…

Retrying again now .

Best Regards shadi

i thank everybody my problem has been solved here

The solution was simply to down grade to version 0.6.1 ( witch seems to be a stable version ) and adapt paramaters to it