Skip to content

Conversation

Judyxujj
Copy link
Contributor

This PR adds dyn_dim_min_sizes and dyn_dim_max_sizes to the command line options of tools/torch_export_to_onnx.py . In default, extern data with time dimension size in range [2,25] would be generated for export, which might be too short for the cases where raw wave input is used. Thus these two options can be used to specify the min/max sizes for dim tags with dynamic sizes.

@Judyxujj Judyxujj requested review from a team and albertz as code owners December 22, 2023 15:00
parser.add_argument("--verbosity", default=4, type=int, help="5 for all seqs (default: 4)")
parser.add_argument("--device", type=str, default="cpu", help="'cpu' (default) or 'gpu'.")
parser.add_argument(
"--dyn_dim_min_sizes", type=dict, default=None, help="Specify min sizes for dim tags with dynamic sizes"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you test this? What exactly did you pass as argument? I wonder how it would correctly convert it into a dict, and specifically with the right Dim objects as keys?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested it by setting the Dim object like this

time_data_dim = SpatialDim('time:data')
extern_data_dict = {'data': {
        'dim_tags': [
            batch_dim,
            time_data_dim,
            FeatureDim('feat', 1),
        ],
        'dtype': 'float32',
    }}
dyn_dim_max_sizes={time_data_dim:100}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, how did you start this script? How did you pass --dyn_dim_min_sizes when starting the script?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants