mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-07 22:11:09 +08:00
182 lines
7.0 KiB
Markdown
182 lines
7.0 KiB
Markdown
|
PyTorch 1.0 Preview Release: Facebook’s newest Open Source AI
|
|||
|
======
|
|||
|
Facebook already uses its own Open Source AI, PyTorch quite extensively in its own artificial intelligence projects. Recently, they have gone a league ahead by releasing a pre-release preview version 1.0.
|
|||
|
|
|||
|
For those who are not familiar, [PyTorch][1] is a Python-based library for Scientific Computing.
|
|||
|
|
|||
|
PyTorch harnesses the [superior computational power of Graphical Processing Units (GPUs)][2] for carrying out complex [Tensor][3] computations and implementing [deep neural networks][4]. So, it is used widely across the world by numerous researchers and developers.
|
|||
|
|
|||
|
This new ready-to-use [Preview Release][5] was announced at the [PyTorch Developer Conference][6] at [The Midway][7], San Francisco, CA on Tuesday, October 2, 2018.
|
|||
|
|
|||
|
### Highlights of PyTorch 1.0 Release Candidate
|
|||
|
|
|||
|
![PyTorhc is Python based open source AI framework from Facebook][8]
|
|||
|
|
|||
|
Some of the main new features in the release candidate are:
|
|||
|
|
|||
|
#### 1\. JIT
|
|||
|
|
|||
|
JIT is a set of compiler tools to bring research close to production. It includes a Python-based language called Torch Script and also ways to make existing code compatible with itself.
|
|||
|
|
|||
|
#### 2\. New torch.distributed library: “C10D”
|
|||
|
|
|||
|
“C10D” enables asynchronous operation on different backends with performance improvements on slower networks and more.
|
|||
|
|
|||
|
#### 3\. C++ frontend (experimental)
|
|||
|
|
|||
|
Though it has been specifically mentioned as an unstable API (expected in a pre-release), this is a pure C++ interface to the PyTorch backend that follows the API and architecture of the established Python frontend to enable research in high performance, low latency and C++ applications installed directly on hardware.
|
|||
|
|
|||
|
To know more, you can take a look at the complete [update notes][9] on GitHub.
|
|||
|
|
|||
|
The first stable version PyTorch 1.0 will be released in summer.
|
|||
|
|
|||
|
### Installing PyTorch on Linux
|
|||
|
|
|||
|
To install PyTorch v1.0rc0, the developers recommend using [conda][10] while there also other ways to do that as shown on their [local installation page][11] where they have documented everything necessary in detail.
|
|||
|
|
|||
|
#### Prerequisites
|
|||
|
|
|||
|
* Linux
|
|||
|
* Pip
|
|||
|
* Python
|
|||
|
* [CUDA][12] (For Nvidia GPU owners)
|
|||
|
|
|||
|
|
|||
|
|
|||
|
As we recently showed you [how to install and use Pip][13], let’s get to know how we can install PyTorch with it.
|
|||
|
|
|||
|
Note that PyTorch has GPU and CPU-only variants. You should install the one that suits your hardware.
|
|||
|
|
|||
|
#### Installing old and stable version of PyTorch
|
|||
|
|
|||
|
If you want the stable release (version 0.4) for your GPU, use:
|
|||
|
|
|||
|
```
|
|||
|
pip install torch torchvision
|
|||
|
|
|||
|
```
|
|||
|
|
|||
|
Use these two commands in succession for a CPU-only stable release:
|
|||
|
|
|||
|
```
|
|||
|
pip install http://download.pytorch.org/whl/cpu/torch-0.4.1-cp27-cp27mu-linux_x86_64.whl
|
|||
|
pip install torchvision
|
|||
|
|
|||
|
```
|
|||
|
|
|||
|
#### Installing PyTorch 1.0 Release Candidate
|
|||
|
|
|||
|
You install PyTorch 1.0 RC GPU version with this command:
|
|||
|
|
|||
|
```
|
|||
|
pip install torch_nightly -f https://download.pytorch.org/whl/nightly/cu92/torch_nightly.html
|
|||
|
|
|||
|
```
|
|||
|
|
|||
|
If you do not have a GPU and would prefer a CPU-only version, use:
|
|||
|
|
|||
|
```
|
|||
|
pip install torch_nightly -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
|
|||
|
|
|||
|
```
|
|||
|
|
|||
|
#### Verifying your PyTorch installation
|
|||
|
|
|||
|
Startup the python console on a terminal with the following simple command:
|
|||
|
|
|||
|
```
|
|||
|
python
|
|||
|
|
|||
|
```
|
|||
|
|
|||
|
Now enter the following sample code line by line to verify your installation:
|
|||
|
|
|||
|
```
|
|||
|
from __future__ import print_function
|
|||
|
import torch
|
|||
|
x = torch.rand(5, 3)
|
|||
|
print(x)
|
|||
|
|
|||
|
```
|
|||
|
|
|||
|
You should get an output like:
|
|||
|
|
|||
|
```
|
|||
|
tensor([[0.3380, 0.3845, 0.3217],
|
|||
|
[0.8337, 0.9050, 0.2650],
|
|||
|
[0.2979, 0.7141, 0.9069],
|
|||
|
[0.1449, 0.1132, 0.1375],
|
|||
|
[0.4675, 0.3947, 0.1426]])
|
|||
|
|
|||
|
```
|
|||
|
|
|||
|
To check whether you can use PyTorch’s GPU capabilities, use the following sample code:
|
|||
|
|
|||
|
```
|
|||
|
import torch
|
|||
|
torch.cuda.is_available()
|
|||
|
|
|||
|
```
|
|||
|
|
|||
|
The resulting output should be:
|
|||
|
|
|||
|
```
|
|||
|
True
|
|||
|
|
|||
|
```
|
|||
|
|
|||
|
Support for AMD GPUs for PyTorch is still under development, so complete test coverage is not yet provided as reported [here][14], suggesting this [resource][15] in case you have an AMD GPU.
|
|||
|
|
|||
|
Lets now look into some research projects that extensively use PyTorch:
|
|||
|
|
|||
|
### Ongoing Research Projects based on PyTorch
|
|||
|
|
|||
|
* [Detectron][16]: Facebook AI Research’s software system to intelligently detect and classify objects. It is based on Caffe2. Earlier this year, Caffe2 and PyTorch [joined forces][17] to create a Research + Production enabled PyTorch 1.0 we talk about.
|
|||
|
* [Unsupervised Sentiment Discovery][18]: Such methods are extensively used with social media algorithms.
|
|||
|
* [vid2vid][19]: Photorealistic video-to-video translation
|
|||
|
* [DeepRecommender][20] (We covered how such systems work on our past [Netflix AI article][21])
|
|||
|
|
|||
|
|
|||
|
|
|||
|
Nvidia, leading GPU manufacturer covered more on this with their own [update][22] on this recent development where you can also read about ongoing collaborative research endeavours.
|
|||
|
|
|||
|
### How should we react to such PyTorch capabilities?
|
|||
|
|
|||
|
To think Facebook applies such amazingly innovative projects and more in its social media algorithms, should we appreciate all this or get alarmed? This is almost [Skynet][23]! This newly improved production-ready pre-release of PyTorch will certainly push things further ahead! Feel free to share your thoughts with us in the comments below!
|
|||
|
|
|||
|
--------------------------------------------------------------------------------
|
|||
|
|
|||
|
via: https://itsfoss.com/pytorch-open-source-ai-framework/
|
|||
|
|
|||
|
作者:[Avimanyu Bandyopadhyay][a]
|
|||
|
选题:[lujun9972](https://github.com/lujun9972)
|
|||
|
译者:[译者ID](https://github.com/译者ID)
|
|||
|
校对:[校对者ID](https://github.com/校对者ID)
|
|||
|
|
|||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
|||
|
|
|||
|
[a]: https://itsfoss.com/author/avimanyu/
|
|||
|
[1]: https://pytorch.org/
|
|||
|
[2]: https://en.wikipedia.org/wiki/General-purpose_computing_on_graphics_processing_units
|
|||
|
[3]: https://en.wikipedia.org/wiki/Tensor
|
|||
|
[4]: https://www.techopedia.com/definition/32902/deep-neural-network
|
|||
|
[5]: https://code.fb.com/ai-research/facebook-accelerates-ai-development-with-new-partners-and-production-capabilities-for-pytorch-1-0
|
|||
|
[6]: https://pytorch.fbreg.com/
|
|||
|
[7]: https://www.themidwaysf.com/
|
|||
|
[8]: https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/10/pytorch.jpeg
|
|||
|
[9]: https://github.com/pytorch/pytorch/releases/tag/v1.0rc0
|
|||
|
[10]: https://conda.io/
|
|||
|
[11]: https://pytorch.org/get-started/locally/
|
|||
|
[12]: https://www.pugetsystems.com/labs/hpc/How-to-install-CUDA-9-2-on-Ubuntu-18-04-1184/
|
|||
|
[13]: https://itsfoss.com/install-pip-ubuntu/
|
|||
|
[14]: https://github.com/pytorch/pytorch/issues/10657#issuecomment-415067478
|
|||
|
[15]: https://rocm.github.io/install.html#installing-from-amd-rocm-repositories
|
|||
|
[16]: https://github.com/facebookresearch/Detectron
|
|||
|
[17]: https://caffe2.ai/blog/2018/05/02/Caffe2_PyTorch_1_0.html
|
|||
|
[18]: https://github.com/NVIDIA/sentiment-discovery
|
|||
|
[19]: https://github.com/NVIDIA/vid2vid
|
|||
|
[20]: https://github.com/NVIDIA/DeepRecommender/
|
|||
|
[21]: https://itsfoss.com/netflix-open-source-ai/
|
|||
|
[22]: https://news.developer.nvidia.com/pytorch-1-0-accelerated-on-nvidia-gpus/
|
|||
|
[23]: https://en.wikipedia.org/wiki/Skynet_(Terminator)
|