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

ONNX: Unexpected end of file #1155

Open
lutzroeder opened this issue Sep 23, 2023 · 10 comments
Open

ONNX: Unexpected end of file #1155

lutzroeder opened this issue Sep 23, 2023 · 10 comments

Comments

@lutzroeder
Copy link
Owner

lutzroeder commented Sep 23, 2023

Please help by providing information how to reproduce this issue:

  • Add steps how the file that caused this issue was created
  • Attach the model file below to help investigate what is causing this issue.
@lutzroeder lutzroeder closed this as not planned Won't fix, can't repro, duplicate, stale Sep 23, 2023
@lutzroeder lutzroeder reopened this Oct 27, 2023
@jerly-hjzhou
Copy link

jerly-hjzhou commented Oct 30, 2023

I used the ONNX model generated by the python script in the attachment, which passed the check using onnx.checker.check_model, but it cannot be opened correctly with Netron

export_levit.zip

@lutzroeder
Copy link
Owner Author

@jerly-hjzhou running the script does not reproduce the issue. Can you share the file that fails to load or a screenshot of the end of the file in a hex editor?

@fefe982
Copy link

fefe982 commented Oct 31, 2023

When I use netron foo.onnx to start a server with v7.2.7, and then view it in Firefox, I met a similar issue.

It sometimes produces "Unexpected end of file", and sometimes "view.View is not constructor", or "window.host is undefined", or a black and white (no color) graph, or "view.Sidebar is not a constructor", or "base.Tlemetry is not a constructor", or load successfully. It can load successfully after several reloads.

I suspect it is a synchronizing issue, that when a js object is needed, it is not fully loaded. But I have no proof.

@lutzroeder
Copy link
Owner Author

lutzroeder commented Nov 1, 2023

@fefe982 can you help investigate this issue?

  • If you run with netron --verbosity debug ..., does it show any errors in the log when this happens?
  • Are you using --browse or copy pasting the URL into the browser?
  • What operating system or browser are you using?
  • Are you running both the server and browser on the same machine, e.g. localhost?

@fefe982
Copy link

fefe982 commented Nov 1, 2023

@fefe982 can you help investigate this issue?

* If you run with `netron --verbosity debug ...`, does it show any errors in the log when this happens?

Only a bunch of 200. But there are some errors in the browser's console:

EvalError: call to eval() blocked by CSP
    r moz-extension://3638b928-526f-44b7-9d76-ec56f09183be/build/detector.js:1
    <anonymous> moz-extension://3638b928-526f-44b7-9d76-ec56f09183be/build/detector.js:1
    <anonymous> moz-extension://3638b928-526f-44b7-9d76-ec56f09183be/build/detector.js:1
    <anonymous> moz-extension://3638b928-526f-44b7-9d76-ec56f09183be/build/detector.js:1
    inject resource://gre/modules/ExtensionContent.sys.mjs:581
    AsyncFunctionNext self-hosted:852
Content-Security-Policy: The page’s settings blocked the loading of a resource at eval (“script-src”).
Source: ;(function n(e){let t=1e3,n=10;function … [127.0.0.1:8080](http://127.0.0.1:8080/)
Uncaught SyntaxError: missing } in compound statement [grapher.js:642:27](http://127.0.0.1:8080/grapher.js)note: { opened at line 641, column 72[grapher.js:641:72](http://127.0.0.1:8080/grapher.js)
Uncaught Error: Module './grapher' not found.
    require http://127.0.0.1:8080/index.js:47
    <anonymous> http://127.0.0.1:8080/view.js:13
[index.js:47:15](http://127.0.0.1:8080/index.js)
    require http://127.0.0.1:8080/index.js:47
    <anonymous> http://127.0.0.1:8080/view.js:13
Uncaught TypeError: view.View is not a constructor
    <anonymous> http://127.0.0.1:8080/index.js:120
    next http://127.0.0.1:8080/index.js:60
    next http://127.0.0.1:8080/index.js:73
    loadHandler http://127.0.0.1:8080/index.js:30
    require http://127.0.0.1:8080/index.js:40
    next http://127.0.0.1:8080/index.js:66
    next http://127.0.0.1:8080/index.js:73
    loadHandler http://127.0.0.1:8080/index.js:30
    require http://127.0.0.1:8080/index.js:40
    next http://127.0.0.1:8080/index.js:66
    next http://127.0.0.1:8080/index.js:73
    loadHandler http://127.0.0.1:8080/index.js:30
    require http://127.0.0.1:8080/index.js:40
    next http://127.0.0.1:8080/index.js:66
    preload http://127.0.0.1:8080/index.js:78
    <anonymous> http://127.0.0.1:8080/index.js:114
    EventListener.handleEvent* http://127.0.0.1:8080/index.js:110
[index.js:120:31](http://127.0.0.1:8080/index.js)
    <anonymous> http://127.0.0.1:8080/index.js:120
    next http://127.0.0.1:8080/index.js:60
    next http://127.0.0.1:8080/index.js:73
    loadHandler http://127.0.0.1:8080/index.js:30
    (Async: EventListener.handleEvent)
    require http://127.0.0.1:8080/index.js:40
    next http://127.0.0.1:8080/index.js:66
    next http://127.0.0.1:8080/index.js:73
    loadHandler http://127.0.0.1:8080/index.js:30
    (Async: EventListener.handleEvent)
    require http://127.0.0.1:8080/index.js:40
    next http://127.0.0.1:8080/index.js:66
    next http://127.0.0.1:8080/index.js:73
    loadHandler http://127.0.0.1:8080/index.js:30
    (Async: EventListener.handleEvent)
    require http://127.0.0.1:8080/index.js:40
    next http://127.0.0.1:8080/index.js:66
    preload http://127.0.0.1:8080/index.js:78
    <anonymous> http://127.0.0.1:8080/index.js:114
    (Async: EventListener.handleEvent)
    <anonymous> http://127.0.0.1:8080/index.js:110

The error mentioned grapher.js. I checked grapher.js in the network panel of the brower's Developer Tools, I can only see partial response. The content of the js is not fully transfered. The Content-Length says it has 25kB, but only 22kB is transferred.

The Transferred column of several items (including grapher.js) has a (raced) mark ,e.g. 22.55 kB (raced) .

When accessing single item, the full content can be transferred, and there is not (raced) mark.

* Are you using `--browse` or copy pasting the URL into the browser?

I'm typing the URL in the browser.

* What operating system or browser are you using?
* Are you running both the server and browser on the same machine, e.g. `localhost`?

The environment is a bit complicated.

netron is run in a container, the container is in a remote Linux machine. I'm running VS Code on a local Windows machine, and used the port forwarding function of Remote SSH / Remote Container of VS Code to access it form the Windows machine. The browser is firefox.

@fefe982
Copy link

fefe982 commented Nov 1, 2023

After several tests and searching the web, the raced mark should be irrelevant. It is about the use of cache vs accessing the web ref . And I can get partial content with or without the raced mark.

The partial content problem can happen on any file. When only partial content of the onnx file is received, I got Unexpected end of file.

@jerly-hjzhou
Copy link

It's so strange, I was able to open this model today. I thought you had resolved this issue, haha.

@lutzroeder
Copy link
Owner Author

The content of the js is not fully transfered. The Content-Length says it has 25kB, but only 22kB is transferred.

@fefe982 any insights why this might be happening or how to reproduce it?

@octavflorescu
Copy link

octavflorescu commented Nov 9, 2023

I have encountered the same error, and the reason in my case was pretty straight forward: model was generated on server, i was copying it to local machine, and i did not wait for the transfer to finish.

@lutzroeder lutzroeder closed this as not planned Won't fix, can't repro, duplicate, stale Apr 26, 2024
@lutzroeder
Copy link
Owner Author

lutzroeder commented May 12, 2024

Please attach the model file to reproduce this issue or steps how it was created.

@lutzroeder lutzroeder reopened this Dec 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants