Joshua

Xenova

AI & ML interests

None yet

Articles

Organizations

Xenova's activity

replied to their post 15 days ago
view reply

Indeed! The model is cached on first load and will be reused once you refresh the page.

posted an update 21 days ago
view post
Post
6835
Introducing MusicGen Web: AI-powered music generation directly in your browser, built with πŸ€— Transformers.js! 🎡

Everything runs 100% locally, meaning there are no calls to an API! 🀯 Since it's served as a static HF space, it costs $0 to host and run! πŸ”₯

We also added the ability to share your generated music to the discussion tab, so give it a try! πŸ‘‡
Xenova/musicgen-web
  • 2 replies
Β·
posted an update about 2 months ago
view post
Post
Introducing the πŸ€— Transformers.js WebGPU Embedding Benchmark! ⚑️
πŸ‘‰ Xenova/webgpu-embedding-benchmark πŸ‘ˆ

On my device, I was able to achieve a 64.04x speedup over WASM! 🀯 How much does WebGPU speed up ML models running locally in your browser? Try it out and share your results! πŸš€
  • 2 replies
Β·
replied to their post 2 months ago
posted an update 2 months ago
view post
Post
Real-time object detection w/ πŸ€— Transformers.js, running YOLOv9 locally in your browser! 🀯

Try it out yourself: Xenova/video-object-detection
(Model used + example code: Xenova/gelan-c_all)

This demo shows why on-device ML is so important:
1. Privacy - local inference means no user data is sent to the cloud
2. No server latency - empowers developers to build real-time applications
3. Lower costs - no need to pay for bandwidth and processing of streamed video

I can't wait to see what you build with it! πŸ”₯
  • 3 replies
Β·
replied to their post 3 months ago
view reply

The source code can be found here.

Note that it’s just vanilla JavaScript, but you can integrate it into your own react application.

replied to their post 3 months ago
view reply

Hi there! I suppose you could do this with custom configs and specifying the model_file_name (see here). Feel free to open an issue on GitHub and I'll be happy to try provide example code. Alternatively, you can find the .onnx files here, then use onnxruntime-node on the server and onnxruntime-web on the client to load the models. You can use the SamProcessor (provided by transformers.js) to do the pre- and post-processing (see model card for example usage).

posted an update 3 months ago
view post
Post
Introducing Remove Background Web: In-browser background removal, powered by @briaai 's new RMBG-v1.4 model and πŸ€— Transformers.js!

Everything runs 100% locally, meaning none of your images are uploaded to a server! 🀯 At only ~45MB, the 8-bit quantized version of the model is perfect for in-browser usage (it even works on mobile).

Check it out! πŸ‘‡
Demo: Xenova/remove-background-web
Model: briaai/RMBG-1.4
Β·
replied to their post 3 months ago
replied to their post 3 months ago
replied to their post 3 months ago
posted an update 4 months ago
view post
Post
Last week, we released πŸ€— Transformers.js v2.14, which added support for SAM (Segment Anything Model).

This means you can now generate high-quality segmentation masks for objects in a scene, directly in your browser! 🀯

Demo (+ source code): Xenova/segment-anything-web
Model: Xenova/slimsam-77-uniform

But how does this differ from Meta's original demo? πŸ€” Didn't that also run in-browser?

Well, in their demo, the image embeddings are computed server-side, then sent to the client for decoding. Trying to do this all client-side would be completely impractical: taking minutes per image! πŸ˜΅β€πŸ’«

That's where SlimSAM comes to the rescue! SlimSAM is a novel SAM compression method, able to shrink the model over 100x (637M β†’ 5.5M params), while still achieving remarkable results!

The best part? You can get started in a few lines of JavaScript code, thanks to Transformers.js! πŸ”₯

// npm i @xenova/transformers
import { SamModel, AutoProcessor, RawImage } from '@xenova/transformers';

// Load model and processor
const model = await SamModel.from_pretrained('Xenova/slimsam-77-uniform');
const processor = await AutoProcessor.from_pretrained('Xenova/slimsam-77-uniform');

// Prepare image and input points
const img_url = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/corgi.jpg';
const raw_image = await RawImage.read(img_url);
const input_points = [[[340, 250]]];

// Process inputs and perform mask generation
const inputs = await processor(raw_image, input_points);
const outputs = await model(inputs);

// Post-process masks
const masks = await processor.post_process_masks(outputs.pred_masks, inputs.original_sizes, inputs.reshaped_input_sizes);
console.log(masks);

// Visualize the mask
const image = RawImage.fromTensor(masks[0][0].mul(255));
image.save('mask.png');


I can't wait to see what you build with it! πŸ€—
Β·