Skip to content

TypeError in wsj/s5/steps/libs/nnet3/train #2818

Closed
@mthrok

Description

@mthrok

Hi

Sorry if this is duplicated issue.

It seems that archive_index argument in get_multitask_egs_opts function is expected to be integer,

egs_suffix = ".{0}".format(archive_index) if archive_index > -1 else ""

but compute_preconditioning_matrix is passing a string object.

    multitask_egs_opts = common_train_lib.get_multitask_egs_opts(
        egs_dir,
        egs_prefix="cegs.",
        archive_index="JOB",
        use_multitask_egs=use_multitask_egs)

This causes WSJ example to fail with the following error message.

Traceback (most recent call last):
  File "steps/nnet3/chain/train.py", line 622, in main
    train(args, run_opts)
  File "steps/nnet3/chain/train.py", line 428, in train
    use_multitask_egs=use_multitask_egs)
  File "steps/libs/nnet3/train/chain_objf/acoustic_model.py", line 395, in compute_preconditioning_matrix
    use_multitask_egs=use_multitask_egs)
  File "steps/libs/nnet3/train/common.py", line 74, in get_multitask_egs_opts
    egs_suffix = ".{0}".format(archive_index) if archive_index > -1 else ""
TypeError: '>' not supported between instances of 'str' and 'int'

Changing > to != seems to solve this.

diff --git a/egs/wsj/s5/steps/libs/nnet3/train/common.py b/egs/wsj/s5/steps/libs/nnet3/train/common.py
index d052c78..b8e0322 100644
--- a/egs/wsj/s5/steps/libs/nnet3/train/common.py
+++ b/egs/wsj/s5/steps/libs/nnet3/train/common.py
@@ -71,7 +71,7 @@ def get_multitask_egs_opts(egs_dir, egs_prefix="",
         "valid_diagnostic." for validation.
     """
     multitask_egs_opts = ""
-    egs_suffix = ".{0}".format(archive_index) if archive_index > -1 else ""
+    egs_suffix = ".{0}".format(archive_index) if archive_index != -1 else ""

     if use_multitask_egs:
         output_file_name = ("{egs_dir}/{egs_prefix}output{egs_suffix}.ark"

I am not sure if this is the right thing to do. Could you advice?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions