Skip to content
main
Switch branches/tags
Code

Latest commit

Summary:
We are adding a word-piece tokenizer as part of the data-preprocessing API for nlp models.

The Wordpiece tokenizer is by-default configured to support BertQ&A models. It can also configured to support other Wordpiece nlp models in the future.

How to use:
```
      const question = 'What is PyTorch Live?';
      const context =
        'PyTorch Live is an open source playground for everyone to discover, build, test and share on-device AI demos built on PyTorch. The PyTorch Live monorepo includes the PyTorch Live command line interface (i.e., torchlive), a React Native package to interface with PyTorch Mobile, and a React Native template with examples ready to be deployed on mobile devices.';
      const inputText = `[CLS] ${question} [SEP] ${context} [SEP]`;
      const arr = tokenizer.encode(inputText);
      const t = torch.tensor([arr], {dtype: torch.int});
      // above steps takes ~40ms
      // inference takes ~230ms
      const output = nlpModel.forwardSync(t);
      const startId = output.toGenericDict().start_logits.toTensor().argmax();
      const endId = output.toGenericDict().end_logits.toTensor().argmax();
      const answer = tokenizer.decode(arr.slice(startId, endId + 1));
      console.log(question);
      console.log(answer);
```
(also see the example in the performance tester)

Reviewed By: justinhaaheim, raedle

Differential Revision: D35208621

fbshipit-source-id: 91d520108d73d9421c0d4a985a87ee3d6770f48d
5332dc9

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 

Build your AI powered mobile prototypes in minutes: Get Started · Tutorials · API

 

Deploy Website Torchlive CLI Build Android Template App Build iOS Template App

Current React Native PyTorch Core npm package version. Current PyTorch Live CLI npm package version. Current React Native PyTorch Live template npm package version.

PyTorch Live is released under the MIT license.


PyTorch Live is a set of tools to build AI-powered experiences for mobile.

This monorepo includes the PyTorch Live command line interface (i.e., torchlive-cli), a React Native package to run on-device inference with PyTorch Mobile, and a React Native template with examples ready to be deployed on mobile devices.

Contents

📋 Requirements

PyTorch Live apps may target Android 10.0 (API 21) and iOS 12.0 or newer. You may use Windows, macOS, or Linux as your development operating system, though building and running the PyTorch Live CLI is limited to macOS.

🎉 Building your first PyTorch Live app

Follow the Getting Started guide. PyTorch Live offers a CLI with convenient commands to install development dependencies and initialize new projects. We also have a few tutorials for you to keep going after getting started:

📖 Documentation

The full documentation for PyTorch Live can be found on our website.

👏 How to Contribute

The main purpose of this repository is to continue evolving PyTorch Live. We want to make contributing to this project as easy and transparent as possible, and we are grateful to the community for contributing bug fixes and improvements. Read below to learn how you can take part in improving PyTorch Live.

Code of Conduct

Facebook has adopted a Code of Conduct that we expect project participants to adhere to. Please read the full text so that you can understand what actions will and will not be tolerated.

Contributing Guide

Read our Contributing Guide to learn about our development process, how to propose bugfixes and improvements, and how to build and test your changes to PyTorch Live.

License

PyTorch Live is MIT licensed, as found in the LICENSE file.

About

PyTorch Live is an easy to use library of tools for creating on-device ML demos on Android and iOS. With Live, you can build a working mobile ML prototype in minutes.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published