microsoft/Llama-2-Onnx

LlamaV2_7B_float32 failing onnx checker

alnah005 opened this issue · 0 comments

I created a script to run onnx checker functions on the LlamaV2_7B_float32.onnx model. Below is the script:

import onnx

def check_model(model_path):
    model = onnx.load(model_path)
    

    for i, node in enumerate(model.graph.node):
        
        # Check the node for consistency
        onnx.checker.check_node(node)
        
        # Check attributes of each node
        for attr in node.attribute:
            onnx.checker.check_attribute(attr)    
    
    # Check tensor information in the model
    for init_tensor in model.graph.initializer:
        onnx.checker.check_tensor(init_tensor)

    for value_info in model.graph.value_info:
        onnx.checker.check_value_info(value_info)
    # Check graph consistency
    onnx.checker.check_model(model_path)


if __name__ == "__main__":
    import argparse

    parser = argparse.ArgumentParser(description="Check ONNX model for validation errors.")
    parser.add_argument("model", type=str, help="Path to the ONNX model file.")
    args = parser.parse_args()

    check_model(args.model)

Running

python3 check_onnx_model.py LlamaV2_7B_float32.onnx

returns

onnx.onnx_cpp2py_export.checker.ValidationError: Field 'shape' of type is required but missing.