PyTorch, an open source ML framework based on the Torch library, has grown in popularity in a short span of time. According to Lin Qiao, senior director of engineering at Meta, PyTorch has five core features:
- Eager execution through Python
- Allow developers to build dynamic neural network
- Supports distributed training
- Leverages hardware accelerators
- Focuses on simplicity over complexity
Image: Stack Overflow Developer’s Survey of 2021
What is Pytorch Mobile?
PyTorch Mobile was introduced at the PyTorch Developer Conference in 2019. Allowing developers to work on PyTorch models to run directly on-device turned out to be a gamechanger. Upon release, Meta’s David Reiss said the developers had raised a few concerns about PyTorch Mobile including:
- Did the team build a brand new framework?
- Do we have to export our model to a new format?
- Do we have to post a bunch of new operators?
The answer to all the above questions is a resounding no.
PyTorch Mobile provides an end-to-end workflow that simplifies the research to production environment for mobile devices and privacy-preserving features via federated learning techniques. PyTorch Mobile runs on devices like the Oculus Quest and Portal, desktops and on the Android and iOS mobile apps for Facebook, Instagram, and Messenger.
Features
In terms of features, PyTorch Mobile is available for Linux, Android as well as iOS and provides a mobile interpreter in Android and iOS. It supports tracing and scripting through TorchScript as well as provides support for XNNPACK floating point kernel libraries for Arm CPUs. Moreover, Pytorch Mobile allows for integration of QNNPACK for 8-bit quantized kernels too.
Image: PyTorch
Advantages
- Reduces runtime binary sizes
- Faster execution
- Seamless model deployment
- Convenience: Developers can directly convert a PyTorch model to a mobile-ready format.
Latest developments
In 2020, PyTorch Mobile announced a new prototype feature supporting Android’s Neural Networks API (NNAPI) with a view to expand hardware capabilities to execute models quickly and efficiently. The initial release included support for popular linear convolutional and multilayer perceptron models on Android 10 and above.
PyTorch Live
PyTorch Live was introduced at the PyTorch Developer Day Conference held last December: The set of tools help build cross-platform mobile apps with PyTorch and React Native. Additionally, PyTorch Mobile powers the on-device inference for PyTorch Live.
Rivals: Tensorflow Lite & Apple Core ML
Image: Twitter
Apple Core ML– The machine learning framework allows iOS app developers to integrate machine learning models into their apps.
Image: Apple
Tensorflow Lite: The open source deep learning framework allows the deployment of ML models on mobile as well as IoT devices.