You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please make sure to check off these prerequisites before submitting a bug report.
Test that the bug appears on the current version of the main branch. Make sure to include the commit hash of the commit you checked out.
Check that the issue hasn't already been reported, by checking the currently open issues.
If there are steps to reproduce the problem, make sure to write them down below.
If relevant, please include the ONNX files, which were created directly before and/or after the bug.
Quick summary
cleanup transformation not fixing shape issues related the onnx graph of renet-18.
Details
Please add to the following sections to describe the bug as accurately as possible.
Steps to Reproduce
import netron
import os # netron
from IPython.display import IFrame # netron
import urllib.request
from qonnx.util.cleanup import cleanup
from qonnx.core.modelwrapper import ModelWrapper
def showInNetron(model_filename: str, localhost_url: str = None, port: int = None):
"""Shows a ONNX model file in the Jupyter Notebook using Netron.
:param model_filename: The path to the ONNX model file.
:type model_filename: str
:param localhost_url: The IP address used by the Jupyter IFrame to show the model.
Defaults to localhost.
:type localhost_url: str, optional
:param port: The port number used by Netron and the Jupyter IFrame to show
the ONNX model. Defaults to 8081.
:type port: int, optional
:return: The IFrame displaying the ONNX model.
:rtype: IPython.lib.display.IFrame
"""
try:
port = port or int(os.getenv("NETRON_PORT", default="8081"))
except ValueError:
port = 8081
localhost_url = localhost_url or os.getenv("LOCALHOST_URL", default="localhost")
netron.start(model_filename, address=("0.0.0.0", port), browse=False)
return IFrame(src=f"http://{localhost_url}:{port}/", width="100%", height=400)
Thanks @Harsh9650 for reporting this. I was able to reproduce the bug, which is now fixed and merged as part of #97. Note that override_batchsize is now renamed to override_inpsize and is more generic (i.e. it is also possible to set the spatial dimensions as well as the batch size, if required -- this is handy for e.g. fully convolutional neural networks).
Prerequisites
Please make sure to check off these prerequisites before submitting a bug report.
Quick summary
cleanup transformation not fixing shape issues related the onnx graph of renet-18.
Details
Please add to the following sections to describe the bug as accurately as possible.
Steps to Reproduce
import netron
import os # netron
from IPython.display import IFrame # netron
import urllib.request
from qonnx.util.cleanup import cleanup
from qonnx.core.modelwrapper import ModelWrapper
def showInNetron(model_filename: str, localhost_url: str = None, port: int = None):
"""Shows a ONNX model file in the Jupyter Notebook using Netron.
model_url = ("https://github.com/onnx/models/raw/main/validated/vision/classification/resnet/model/resnet18-v1-7.onnx?download=")
dl_file = "/tmp/resnet18-v1-7.onnx"
urllib.request.urlretrieve(model_url, dl_file)
out_file = "/tmp/resnet18-v1-7_clean.onnx"
cleanup(dl_file, out_file=out_file, override_batchsize = 1) # Batchsize for resnet18 is set to 1.
showInNetron(out_file)
Expected behavior
All tensors should have their respective shapes after cleanup.
Actual behavior
Most tensors missing shapes.
Optional
Possible fix
Transforming the model using InferShapes transformation (from qonnx.transformation.infer_shapes import InferShapes)
Additional context
Faced this problem with only the model specified above.
The text was updated successfully, but these errors were encountered: