npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@nanopore/tfjs-backend-webgpu

v0.0.1-alpha.17

Published

This package adds a GPU accelerated [WebGPU](https://www.w3.org/TR/webgpu/) backend to TensorFlow.js. It currently supports the following models: - BlazeFace - BodyPix - Face landmarks detection - HandPose - MobileNet - PoseDetection - Universal sentence

Downloads

8

Readme

Usage

This package adds a GPU accelerated WebGPU backend to TensorFlow.js. It currently supports the following models:

  • BlazeFace
  • BodyPix
  • Face landmarks detection
  • HandPose
  • MobileNet
  • PoseDetection
  • Universal sentence encoder
  • AutoML Image classification
  • AutoML Object detection
  • Speech commands

Note that WebGPU hasn't been officially supported by browsers. Only Google Chrome is well tested, and its Canary Channel is highly recommended for your trial. Specify option "--enable-unsafe-webgpu" before you start the Chrome.

Importing the backend

Via NPM

// Import @tensorflow/tfjs or @tensorflow/tfjs-core
import * as tf from '@tensorflow/tfjs';
// Add the WebGPU backend to the global backend registry.
import '@tensorflow/tfjs-backend-webgpu';
// Set the backend to WebGPU and wait for the module to be ready.
tf.setBackend('webgpu').then(() => main());

Via a script tag

<!-- Import @tensorflow/tfjs or @tensorflow/tfjs-core -->
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs/dist/tf.min.js"> </script>

<!-- Add the WebGPU backend to the global backend registry -->
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-webgpu/dist/tf-backend-webgpu.js"></script>
<script>
// Set the backend to WebGPU and wait for the module to be ready
tf.setBackend('webgpu').then(() => main());
</script>

FAQ

When should I use the WebGPU backend?

The mission of WebGPU backend is to achieve the best performance among all approaches. However, this target can not be met overnight, but we are committed to supporting it with rapid and continuous performance improvement. Many exciting features, like FP16, DP4A, will be brought in soon.

How many ops have you implemented?

See register_all_kernels.ts for an up-to-date list of supported ops. We love contributions. See the contributing document for more info.

Do you support training?

Maybe. There are still a decent number of ops that we are missing in WebGPU that are needed for gradient computation. At this point we are focused on making inference as fast as possible.

Do you work in node?

Yes. If you run into issues, please let us know.

How do I give feedback?

We'd love your feedback as we develop this backend! Please file an issue here.

Development

Building

yarn build

Testing

Currently the Canary channel of Chrome is used for testing of the WebGPU backend:

yarn test  # --test_env=CHROME_CANARY_BIN=/path/to/chrome