X
Innovation

​Facebook open-sources PyTorch 1.0 AI framework

Facebook already uses PyTorch in-house for its machine learning and artificial intelligence projects and now it's open-sourcing it for everyone.
Written by Steven Vaughan-Nichols, Senior Contributing Editor

Would it surprise you to know Facebook is working on machine learning (ML) and artificial intelligence (AI)? No. I didn't think it would. Now, Facebook is open-sourcing PyTorch, its deep learning framework.

PyTorch 1.0 provides developers with the power to seamlessly move from research to production in a single framework. PyTorch 1.0 integrates PyTorch's research-oriented aspects with the modular, production-focused capabilities of Caffe2, a popular deep learning framework and ONNX (Open Neural Network Exchange), an open format to represent deep learning models.

Facebook has already been using this unified framework firsthand. PyTorch 1.0's underlying technology supports AI in many of Facebook's products. The most prominent example is how Facebook now uses AI on neural networks to perform 6 billion translations a day.

The framework is part of Facebook's continued efforts to share its AI research and code openly, with a broader goal of advancing innovation in AI and machine learning research. PyTorch, as the name suggests, is based on Python.

With PyTorch 1.0, AI developers can both experiment rapidly and optimize performance through a hybrid front end that seamlessly transitions between imperative and declarative execution modes. Facebook claims PyTorch's imperative front end allows for more rapid prototyping and experimentation through its flexible and productive programming model.

The first version of PyTorch launched a little over a year ago. Its speed, productivity, and ability to support cutting-edge AI models such as dynamic graphs has quickly made it a popular and important AI development tool. It has over 1.1 million downloads.

PyTorch has its problems. Facebook admits that while PyTorch currently is very flexible, performance at production-scale is a challenge, given its tight coupling to Python. As a result, programmers usually translate the research code -- either training script or trained model -- to a graph mode representation in Caffe2 to run at production scale.

Once in Caffe2, Cafe2's graph-based executor allows developers to take advantage of graph transformations, efficient memory reuse, and tight hardware interface integration. The Caffe2 project was launched two years ago to standardize Facebook's production AI tooling. It's now running neural networks across Facebook servers and on over 1 billion phones around the world. Today, Caffe2 delivers more than 200 trillion predictions per day.

Today, migrating from PyTorch to Caffe2 to production is a manual process That means it's both time-intensive and error-prone.

Facebook has used PyTorch, Caffe2, and ONNX to build and deploy Translate. This is the AI tool that powers translations for the 48 most commonly used languages on Facebook.

However, while this combination of three different tools has been effective, there are still manual steps that are complicated and time-consuming. It's Facebook hope that, with open-source developers' help, PyTorch 1.0 can fuse together immediate and graph execution modes.

Thus, moving forward, rather than forcing developers to do an entire code rewrite to optimize or migrate from Python, PyTorch 1.0 will provide a hybrid front end to seamlessly share most code between immediate mode for prototyping and graph execution mode for production.

Looking ahead, Facebook will also open source many of its other production AI tools. These include Translate -- a PyTorch Language Library -- for fast, flexible neural machine translation, as well as the next generation of Ensemble Learning Framework (ELF), a comprehensive game platform for AI reasoning applications.

Facebook said that developers will also be able to take advantage of tools like Glow, a machine learning compiler that accelerates framework performance on different hardware platforms, and Tensor Comprehensions, a tool that automatically generates efficient GPU code from high-level mathematical operations. "We have also open-sourced other libraries, such as Detectron, which supports object-detection research, covering both bounding box and object instance segmentation outputs," it added. For the full list, see Facebook's AI developer site.

Facebook isn't going this alone. Microsoft plans to support PyTorch 1.0 in Azure and developer offerings, including Azure Machine Learning services and Data Science Virtual Machines. Amazon Web Services (AWS) already supports PyTorch.

Facebook hopes to create and share a better AI programming approach. For Facebook, AI is a "foundational technology". "By opening up our work via papers, code, and models, we can work with all AI researchers and practitioners to advance the state of the art faster and to help apply these techniques in new ways," it concluded.

PyTorch 1.0 will be available in beta within the next few months. It will also include a family of tools, libraries, pre-trained models, and datasets for each stage of development.

Related Stories:

Editorial standards