MindSpore “RuntimeError: Unexpected error. Invalid data.“

created at 07-03-2022 views: 22

1. problem track

1.1 System Environment

  • ardware Environment(Ascend/GPU/CPU): CPU
  • Software Environment:
    • – MindSpore version (source or binary): 1.6.0
    • – Python version (e.g., Python 3.7.5): 3.7.6
    • – OS platform and distribution (e.g., Linux Ubuntu 16.04): Ubuntu 4.15.0-74-generic
    • – GCC/Compiler version (if compiled from source):

1.2 Basic information

1.2.1 Script

This case converts a custom dataset into MindSpore Record data format


1.2.2 Error reporting

RuntimeError: Unexpected error. Invalid data, the number of schema should be positive but got: 0. Please check the input schema.

2 Reason analysis

Error message: Invalid data means invalid data, the type defined for intent_ids is inconsistent with the actual data type used, resulting in no matching data.

3 Solutions

Change intent_label_ids to the type used for the input data.

4 Summary

Steps to locate the error report:

  1. Find the line of user code that reported the error: writer.write_raw_data(data);
  2. According to the prompt in the log error message: "Invalid data, the number of schema should be positive but got: 0. Please check the input schema.", there may be a problem when locating the data input part. Combined with the previous warning: "for schema, 0 th data is wrong, data type for 'intent_ids' is not matched." can locate the error when intent_ids data is written, check and find that intent_ids is a one-dimensional array , the input is a single data during traversal, and it is defined as a numpy type in the code, which causes the data to not match the relevant type of data when reading.
  3. Data input needs to be consistent with the type definition in the script.



created at:07-03-2022
edited at: 07-03-2022: