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

CoreML: block_specializations.CoreML7 #1149

Closed
aseemw opened this issue Sep 10, 2023 · 3 comments
Closed

CoreML: block_specializations.CoreML7 #1149

aseemw opened this issue Sep 10, 2023 · 3 comments
Assignees
Labels

Comments

@aseemw
Copy link

aseemw commented Sep 10, 2023

  • Netron app and version: 7.1.6
  • OS and browser version: macOS Ventura

Error: "Cannot read properties of undefined (reading 'operations')"

Steps to Reproduce:

Model attached. Here is the code that produced it

# coremltools==7.0b2

import coremltools as ct
import coremltools.optimize.torch as cto
import torch
import torch.nn as nn

torch_model = nn.Sequential(
                        nn.Conv2d(3, 12, (1, 1), (1, 1), padding=(0, 0)),
                        nn.BatchNorm2d(12),
              )

data = torch.randn(1, 3, 32, 32)
config = cto.quantization.LinearQuantizerConfig.from_dict(
    {
        "global_config": {
            "quantization_scheme": "symmetric",
            "weight_per_channel": True,
        }
    }
)

quantizer = cto.quantization.LinearQuantizer(torch_model, config)
prepared_model = quantizer.prepare(example_inputs=data, inplace=False)
prepared_model(data)
finalized_model = quantizer.finalize(inplace=False)

traced_model = torch.jit.trace(finalized_model, example_inputs=data)

mlmodel = ct.convert(
        traced_model,
        inputs=[ct.TensorType(shape=data.shape)],
        minimum_deployment_target=ct.target.iOS17,
    )
mlmodel.save("simple_activation_quantized_model.mlpackage")
err

simple_activation_quantized_model.mlpackage.zip

@aseemw aseemw added the bug label Sep 10, 2023
@lutzroeder lutzroeder changed the title Error visualizing Core ML model with iOS17.quantize and iOS17.dequantize ops CoreML: block_specializations.CoreML7 Sep 10, 2023
@lutzroeder
Copy link
Owner

lutzroeder commented Sep 10, 2023

@aseemw please submit pull requests with proposed fixes for Core ML issues.

@lutzroeder
Copy link
Owner

Duplicate of #193

@lutzroeder lutzroeder marked this as a duplicate of #193 Sep 10, 2023
@aseemw
Copy link
Author

aseemw commented Sep 10, 2023

@lutzroeder
sorry I do not fully follow. You made this issue a duplicate of #193, but that one is also closed. Shouldn't there be an open issue to track this? Are all the issues in #193 due to the same root cause, hence you have clubbed them together?

@aseemw please submit pull requests with proposed fixes for Core ML issues.

I am not sure which part of the code is failing with this model. I can definitely help to clarify on how to parse the proto messages, if a specific message is tripping the parsing code. Do you know which exact proto message is leading to this error of "cannot read properties of undefined"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants