Decoding Error: Assertion Error

1,704 views
Skip to first unread message

carlo...@edu.unito.it

unread,
Dec 17, 2018, 4:30:52 PM12/17/18
to kaldi-help
Hi everyone,
i have monophone and triphone system, everything is fine but i have errors in the decoding part of my run.sh script.


Here is my case for the triphone (it'sthe same for monophone) :

steps/decode.sh --config conf/decode.config --nj 1 --cmd run.pl exp/tri1/graph data/test exp/tri1/decode
decode.sh: feature type is delta
steps/diagnostic/analyze_lats.sh --cmd run.pl exp/tri1/graph exp/tri1/decode
run.pl: job failed, log is in exp/tri1/decode/log/analyze_alignments.log
steps/decode.sh: Not scoring because local/score.sh does not exist or not executable.

i opened the log file and it reports the following:

Traceback (most recent call last):
  File "steps/diagnostic/analyze_phone_length_stats.py", line 179, in <module>
    assert num_utterances > 0
AssertionError

I am looking at the python script and at its inputs which are contained in the phone_stats.*.gz file:

1 all 6 224
1 all 6 240
1 begin 6 224
1 begin 6 240 

none of them are negative. What could be a possible solution?

Thanks in advance.

Daniel Povey

unread,
Dec 17, 2018, 6:53:47 PM12/17/18
to kaldi-help
I think that assertion in analyze_lats.sh relates to a bug that has now been fixed.

Regarding:

not scoring because local/score.sh does not exist or not executable.

it means what it says.

------------------------

Indirizzo istituzionale di posta elettronica degli studenti e dei laureati dell'Università degli Studi di Torino
Official University of Turin email address for students and graduates 

--
Go to http://kaldi-asr.org/forums.html find out how to join
---
You received this message because you are subscribed to the Google Groups "kaldi-help" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kaldi-help+...@googlegroups.com.
To post to this group, send email to kaldi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kaldi-help/aaa2d652-6f35-4cd3-a9ee-6cb5d4391d00%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

carlo...@edu.unito.it

unread,
Dec 18, 2018, 7:42:46 AM12/18/18
to kaldi-help
So what would you suggest to solve the problem? my kaldi install is from last week

carlo...@edu.unito.it

unread,
Dec 18, 2018, 9:25:30 AM12/18/18
to kaldi-help
i re-installed kaldi and tried again, but the error seems to remain. Also, decode has acceso to score.sh because it is specified in the PATH variable

i upload a zip with my example folder for reference
example.zip

Daniel Povey

unread,
Dec 18, 2018, 1:39:40 PM12/18/18
to kaldi-help
It needs to be called local/score.sh, that script invokes it with a path.  It would usually be a soft link to ../steps/score_kaldi.sh.
That bug is fixed in the latest version of Kaldi, you would just need to do "git pull" or re-download.  Your zipfile contains the old version.


carlo...@edu.unito.it

unread,
Dec 19, 2018, 9:52:02 AM12/19/18
to kaldi-help
i have no problem with score.sh, i am able to run it and get the WER.
My problem is with the  steps/diagnostic/analyze_phone_length_stats.py script, i have an assertion error, as stated in the log file subl exp/tri1/decode/log/analyze_alignments.log :

# gunzip -c exp/tri1/decode/phone_stats.*.gz | steps/diagnostic/analyze_phone_length_stats.py exp/tri1/graph
# Started at Wed Dec 19 15:43:25 CET 2018
#

Traceback (most recent call last):
  File "steps/diagnostic/analyze_phone_length_stats.py", line 171, in <module>
    assert num_utterances > 0
AssertionError
# Accounting: time=0 threads=1
# Ended (code 1) at Wed Dec 19 15:43:25 CET 2018, elapsed time 0 seconds

Anyway i re-upload a version of the example with the scoring working, for reference.
example.zip

Daniel Povey

unread,
Dec 19, 2018, 2:26:19 PM12/19/18
to kaldi-help
The bug is in the script that calls it.

carlo...@edu.unito.it

unread,
Dec 24, 2018, 5:34:03 AM12/24/18
to kaldi-help
I couldn't figure out what the problem is, if you could be more specific it would be appreciated.

Daniel Povey

unread,
Dec 24, 2018, 3:16:11 PM12/24/18
to kaldi-help
I told you already:
"That bug is fixed in the latest version of Kaldi, you would just need to do "git pull" or re-download.  "

carlo...@edu.unito.it

unread,
Jan 23, 2019, 8:29:32 AM1/23/19
to kaldi-help
Dear Daniel,
i still haven't fixed my problem yet. I reinstalled kaldi ultiple times but  keep having the same error.
I updated everything i could but i still get the num utterances error in my steps/diagnostic/analyze_
phone_length_stats.py

The error is in this part of the program:

# This block will print warnings if silence is seen less than 80% of the time at utterance
# beginning and end.
for boundary_type in 'begin', 'end':
    phone_to_lengths = phone_lengths[boundary_type]
    num_utterances = total_phones[boundary_type]
    assert num_utterances > 0
    opt_sil_lengths = phone_to_lengths[optional_silence_phone]
    frequency_percentage = sum(opt_sil_lengths.values()) * 100.0 / num_utterances
    # The reason for this warning is that the tradition in speech recognition is
    # to supply a little silence at the beginning and end of utterances... up to
    # maybe half a second.  If your database is not like this, you should know;
    # you may want to mess with the segmentation to add more silence.
    if frequency_percentage < 80.0:
        print("analyze_phone_length_stats.py: WARNING: optional-silence {0} is seen only {1}% "
              "of the time at utterance {2}.  This may not be optimal.".format(
                optional_silence_phone_text, frequency_percentage, boundary_type))

Also, i always get a 100% WER, i guess the error could be icaused by this error in the decoding process
example.zip

Daniel Povey

unread,
Jan 23, 2019, 2:01:21 PM1/23/19
to kaldi-help
It seems to be failing because nothing was decoded.
Look in your exp/make_mfcc/train/make_mfcc_train.1.log , there are problems there (missing files, too many channels).


Syun

unread,
Jan 24, 2019, 8:24:34 PM1/24/19
to kaldi...@googlegroups.com
And you'd better check the lang/G.fst. 
I printed the lat.1.gz(via lattice-copy command) and noticed that many phones didn't exist in the L.fst(phones like 107 and 94), so I checked the HCLG.fst and G.fst(I used "fstprint" comand to print these fsts), and then I found the G.fst was empty.

Shin


Muhammad Talha Umair Alim

unread,
Apr 28, 2021, 4:15:42 AM4/28/21
to kaldi-help
I have the same problem, many phone don't exist in L.fst. So, what should I do now in this regard? Thank You

Muhammad Talha Umair Alim

unread,
Apr 28, 2021, 4:18:26 AM4/28/21
to kaldi-help
Hi Syun,
 after finding that your G.fst was empty then what did you do after that?

On Friday, 25 January 2019 at 06:24:34 UTC+5 Syun wrote:
Reply all
Reply to author
Forward
0 new messages