Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LlamaV2_7B_float32 failing onnx checker #30

Open
alnah005 opened this issue Nov 14, 2023 · 0 comments
Open

LlamaV2_7B_float32 failing onnx checker #30

alnah005 opened this issue Nov 14, 2023 · 0 comments

Comments

@alnah005
Copy link
Collaborator

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.
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

No branches or pull requests

1 participant