Pytorch 1.1.0
Pytorch 1.1.0于2019-05-01发布,详情见https://github.com/pytorch/pytorch/releases/tag/v1.1.0
注: 不再支持CUDA8.0
概述:官方TensorBoard支持,属性,字典,列表和JIT / TorchScript中用户自定义的类型,改进了分布式
Highlights:
- TensorBoard (试验阶段)
使用TensorBoard(一个用于检查和理解训练运行、张量和图的web应用程序组件)对可视化和模型调试提供了一流的本机支持。PyTorch现在可通过一个简单的命令from torch.utils.tensorboard import SummaryWriter
支持TensorBoard日志记录。直方图、嵌入、标量、图像、文本、图形,以及更多可以在训练过程中可视化。目前,TensorBoard支持还处于试验阶段。
- [JIT] Attributes in ScriptModules
- [JIT] TorchScript中支持字典和列表
- [JIT] TorchScript中的用户定义类(试验阶段) 可以用@torch.jit.script注释
- DistributedDataParallel新功能和教程:nn.parallel.distributeddataparparallel现在可以封装多gpu模块,它支持在一台服务器上使用模型并行(教程)和跨服务器进行数据并行(教程)等用例。
重大更新:
Tensor.set_
: Tensor的设备不能再通过Tensor.set_
.来改变。这通常发生在使用默认CUDA设备设置张量,然后在另一个CUDA设备上交换存储时。相反,从一开始就在正确的装置上建立Tensor (18832).- 注意顺序更改
lr_scheduler.step()
. (7889). torch.unique
: 更改sorted默认值为
True
. (15379).- [JIT] 重命名 isTensor api -> isCompleteTensor. #18437
- [JIT] 移除GraphExecutor的python绑定. #19141
- [C++]:
Type
上的许多方法已不复存在;使用等价的函数法或张量法。 (17991). - [C++]:
TensorOptions的
后端构造函数不再存在. (18137). - [C++, Distributed]: 已删除 c10d
ProcessGroup::getGroupRank
(19147).
Pytorch1.0.1
Pytorch1.0.1于2019-2-7发布,详情见https://github.com/pytorch/pytorch/releases/tag/v1.0.1,
- 修复了很多bug
- JIT
- Add better support for bools in the graph fuser (#15057)
- Allow tracing with fork/wait (#15184)
- improve script/no script save error (#15321)
- Add self to Python printer reserved words (#15318)
- Better error when torch.load-ing a JIT model (#15578)
- fix select after chunk op (#15672)
- Add script standard library documentation + cleanup (#14912)
- 性能优化
- LibTorch binaries now ship with CuDNN enabled. Without this change, many folks saw significant perf differences while using LibTorch vs PyTorch, this should be fixed now. #14976
- Make btriunpack work for high dimensional batches and faster than before (#15286)
- improve performance of unique with inverse indices (#16145)
- Re-enable OpenMP in binaries (got disabled because of a CMake refactor)
Pytorch 1.0
Pytorch 1.0于2018-12-8发布,详见https://github.com/pytorch/pytorch/releases/tag/v1.0.0
- 主要更新
- JIT
- 全新的分布式训练包:
torch.distributed
- 旧的接口放到了
torch.distributed.deprecated
中
- 旧的接口放到了
- C++ 接口 API [尚不稳定]
- Torch HUB:各种预训练模型集合
- 重点更新
- 众多新特性
- 增加了对 N 维空的 tensor 的支持
- 众多新的 tensor 操作
- 新的分布函数
- 对稀疏数据处理的 API 的改进
- 众多新特性
- 修复了众多bug,比如 torch.nn.functional.softmin 在 0.4.1 里的公式是错的,torch.nn.MSELoss 有时候计算错误等等
- 众多改进
- 废弃的方法
- 不再支持 C 接口
- 不再支持 torch.utils.trainer
- 性能优化
升级
本文中pytorch由0.4.0升级到1.0.1,再升级至1.1.0(也可以直接升级至1.1.0)
1. 首先用如下命令查看升级前的pytorch版本,返回版本号是0.4.0
python -c "import torch; print(torch.__version__)"
2. 输入如下命令 conda install pytorch torchvision -c pytorch进行升级
conda install pytorch torchvision -c pytorch
3. 升级后再用1中的命令查看一下升级后的pytorch版本,返回是1.0.1表示升级成功。
4. 重复1-3的步骤可以将pytorch1.0.1再次升级至1.1.0
Note:
在Windows+Python 3.7+CUDA10环境下安装PyTorch 1.2.0的命令如下:
pip install torch==1.2.0 -f https://download.pytorch.org/whl/cu100/torch-1.2.0-cp37-cp37m-win_amd64.whl
Python3.6, CUDA92环境下安装PyTorch1.3的命令为:
pip install torch==1.3.1 -f https://download.pytorch.org/whl/torch_stable.html
参考资料:
1. https://www.pytorchtutorial.com/pytorch-1-0/
2. https://github.com/pytorch/pytorch