source

#2
by baktrian - opened

All the code is obfuscated here

So you took depth anything, and applied the displacement map to a threejs webgpu scene? why obfuscate that?

You can find the source code on the Transformers.js repo in the examples folder: https://github.com/xenova/transformers.js/tree/main/examples/depth-anything-client

The obfuscation is just due to the vite bundler I’m using :) just the default settings.

The only difference is that it’s with experimental WebGPU support, and you can find details for how to enable it on the v3 branch: https://github.com/xenova/transformers.js/pull/545

https://github.com/xenova/transformers.js/pull/545/files

In this PR i don't see specifically about how to enable webgpu for the depth-anything client. I would have assumed some threejs webgpu specific set up since three relies on webgl usually?

Thanks

If i build the transformers.js v3 branch myself, can i just move the dist into my own project and call v3 from there with webgpu enabled ?

@baktrian See the first comment in that PR (link). All you need to do is set the device and dtype attributes, for example:

const model = await AutoModel.from_pretrained('briaai/RMBG-1.4', {
    device: 'webgpu',
    dtype: 'fp32',
});

Sign up or log in to comment