Skip to content

Error: using ceil() in shape computation is not yet supported for MaxPool #1435

@geronimi73

Description

@geronimi73

System Info

@huggingface/transformers 3.7.5
Next.js 14.2.2
Chrome, M3 Macbook

Environment/Platform

  • Website/web-app
  • Browser extension
  • Server-side (e.g., Node.js, Deno, Bun)
  • Desktop app (e.g., Electron)
  • Other (e.g., VSCode extension)

Description

Model: onnx-community/ormbg-ONNX

Processing fails with error (see bottom) if model loaded with webgpu device (Chrome, Mac M3).

this.model = await pipeline(
    'background-removal', 
    'onnx-community/ormbg-ONNX',
    {
        device: "webgpu",
        dtype: 'fp16',
    }
);

Works beautiful if loaded on cpu:

this.model = await pipeline(
    'background-removal', 
    'onnx-community/ormbg-ONNX',
    {
        device: "wasm",
        dtype: 'fp16',
    }
);

Error:

transformers.web.js:8629 An error occurred during model execution: "Error: using ceil() in shape computation is not yet supported for MaxPool".
sessionRun	@	transformers.web.js:8629
Inputs given to model: 
Object pixel_values:  {type: 'float32', dims: Array(4), location: 'cpu', data: Float32Array(3145728)}
[[Prototype]]: Object 
sessionRun	@	transformers.web.js:8630
Uncaught (in promise) Error: using ceil() in shape computation is not yet supported for MaxPool
    at Array.bl (ort.bundle.min.mjs?d796:2252:627)
    at Co.computeKernel (ort.bundle.min.mjs?d796:2838:10416)
    at Object.eval [as ac] (ort.bundle.min.mjs?d796:2838:17635)
    at 845314 (ort-wasm-simd-threaded.jsep.mjs:48:297)
    at ic (ort-wasm-simd-threaded.jsep.mjs:94:443)
    at ort-wasm-simd-threaded.jsep.wasm:0x103a1a6
    at ort-wasm-simd-threaded.jsep.wasm:0x103ae8c
    at ort-wasm-simd-threaded.jsep.wasm:0xf3c61b
    at ort-wasm-simd-threaded.jsep.wasm:0x261d37
    at ort-wasm-simd-threaded.jsep.wasm:0x706404

Reproduction

const model = await pipeline(
    'background-removal', 
    'onnx-community/ormbg-ONNX',
    {
        device: "webgpu",
        dtype: 'fp16',
    }
);
const rawImage = (await model( rawImage ))[0];
rawImage.toCanvas() 

// .. display canvas

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions