Unbundled js?

#1
by Samdoestrash - opened

Hello, thanks for the space, it is really cool! Are there plans to publish the unbundled js files so I can learn and build on top of this?

Yes please, and with a license file as well (because the bundled licenses may be misleading to someone quickly looking through the files) ❤️

Owner

Oh I didn't know so many people were interested! Thanks for the bump @borisAbrega .

The source code is the same as the original version: https://github.com/xenova/transformers.js/tree/main/examples/remove-background-client,
with the following modification:

const model = await AutoModel.from_pretrained('briaai/RMBG-1.4', {
    // Do not require config.json to be present in the repository
    config: { model_type: 'custom' },
});

becomes

const model = await AutoModel.from_pretrained('briaai/RMBG-1.4', {
    // Do not require config.json to be present in the repository
    config: { model_type: 'custom' },
    device: 'webgpu',
    dtype: 'fp32',
});

Of course, you need to install the v3 branch to enable WebGPU support.

hey,
first the project run perfectly remove background then i setup webgpu and did the same that you said but i got this error -
Cannot read properties of undefined (reading 'is_encoder_decoder')

Screenshot 2024-05-10 at 6.14.04 PM.png

Owner

You seem to have removed the line for config

No, i added the config here you an see

Screenshot 2024-05-10 at 6.24.06 PM.png

this is my nextjs config
Screenshot 2024-05-10 at 6.23.24 PM.png

Owner

Hmm, interesting. Can you let me know which line of code (in transformers.js) this error occurs at?

Owner

Nevermind, I was able to reproduce this. Will fix!

Fixed here (and here)

Previous error is fixed, now i am getting this error.

Screenshot 2024-05-11 at 10.05.35 AM.png

Sign up or log in to comment