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

[Web] WebGPU batch inference only the first set of data is correct #18804

Closed
sunpeng222 opened this issue Dec 13, 2023 · 6 comments
Closed

[Web] WebGPU batch inference only the first set of data is correct #18804

sunpeng222 opened this issue Dec 13, 2023 · 6 comments
Labels
platform:web issues related to ONNX Runtime web; typically submitted using template stale issues that have not been addressed in a while; categorized by a bot

Comments

@sunpeng222
Copy link

Describe the issue

I encountered a problem when using WebGPU. When I use batch inference, the results of the second set of data are completely incorrect. The model is not the problem, as my inference using wasm was completely fine.What is the cause of this?My model loading and inference are all placed in the webworker

To reproduce

importScripts("./ort/ort.webgpu.min.js")
let session
init()
async function init() {
    ort.env.wasm.simd = true;
    ort.env.wasm.wasmPaths = "./ort/"
    session = await ort.InferenceSession.create('./end2end_normalized_N.onnx', {
        executionProviders: [{
            name: "webgpu"
        }],
        logSeverityLevel: 3,
        logVerbosityLevel: 3,
    });
    self.postMessage({
        type: "ready",
        data: null
    })
}
self.addEventListener('message', async e => {
    if (e.data.type === "upload") {
        if (!session) {
            self.postMessage({
                type: "noSession",
                data: null
            })
            return
        }
        const tensorA = new ort.Tensor('float32', e.data.data, [2, 224, 224, 3]);
        const feeds = { input_1: tensorA };
        const start = performance.now();
        const results = await session.run(feeds);
        const end = performance.now();

        self.postMessage({
            type: "end",
            data: {
                time: end - start,
                results: results
            }
        })
    }
});

Urgency

No response

ONNX Runtime Installation

Released Package

ONNX Runtime Version or Commit ID

1.16.3

Execution Provider

'webgpu' (WebGPU)

@sunpeng222 sunpeng222 added the platform:web issues related to ONNX Runtime web; typically submitted using template label Dec 13, 2023
@gyagp
Copy link

gyagp commented Dec 13, 2023

Can you give a try on dev release ("https://cdn.jsdelivr.net/npm/onnxruntime-web@dev/dist/ort.webgpu.min.js")?
If the issue still persists, can you share the model?

@sunpeng222
Copy link
Author

Can you give a try on dev release ("https://cdn.jsdelivr.net/npm/onnxruntime-web@dev/dist/ort.webgpu.min.js")? If the issue still persists, can you share the model?

Thank you, the development version has no problem.

@gyagp
Copy link

gyagp commented Dec 13, 2023

Thanks for the confirmation! Please be patient for a new release;) FYI, @fs-eire @guschmue

@MountainAndMorning
Copy link

Is there any timeline for version 1.17.0?

Copy link
Contributor

This issue has been automatically marked as stale due to inactivity and will be closed in 30 days if no further activity occurs. If further support is needed, please provide an update and/or more details.

@github-actions github-actions bot added the stale issues that have not been addressed in a while; categorized by a bot label Jan 14, 2024
Copy link
Contributor

This issue has been automatically closed due to inactivity. Please reactivate if further support is needed.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform:web issues related to ONNX Runtime web; typically submitted using template stale issues that have not been addressed in a while; categorized by a bot
Projects
None yet
Development

No branches or pull requests

3 participants