跳转至

PyTorch Recipes

译者:片刻小哥哥

项目地址:https://pytorch.apachecn.org/2.0/tutorials/recipes/recipes_index

原始地址:https://pytorch.org/tutorials/recipes/recipes_index.html

Recipes 是关于如何使用特定 PyTorch 功能的简短、可操作的示例,与我们的完整教程不同。

  • :material-brush-variant: Colors Change colors with an existing color palette or customize with CSS
  • :material-format-font: Fonts – Choose among 1,000 Google Fonts or load self-hosted fonts
  • :material-google-downasaur: Logo & Icons – Change the logo, use any of the 8,000+ icons, or add new ones
  • :material-cards-variant: Social Cards – Automatically create social media previews when sharing links
### 定义神经网络

<img src="https://pytorch.org/tutorials/_static/img/thumbnails/cropped/defining-a-network.PNG" width=20% />

[了解如何使用 PyTorch 的 torch.nn 包为 MNIST 数据集创建和定义神经网络](https://pytorch.org/tutorials/recipes/recipes/defining_a_neural_network.html)

### PyTorch 中的 state_dict 是什么

<img src="https://pytorch.org/tutorials/_static/img/thumbnails/cropped/what-is-a-state-dict.PNG" width=20% />

[了解如何使用 state_dict 对象和 Python 字典从 PyTorch 保存或加载模型](https://pytorch.org/tutorials/recipes/recipes/what_is_state_dict.html)

### 在 PyTorch 中保存和加载模型以进行推理

<img src="https://pytorch.org/tutorials/_static/img/thumbnails/cropped/saving-and-loading-models-for-inference.PNG" width=20% />

[了解在 PyTorch 中保存和加载模型进行推理的两种方法 - 通过 state\_dict 和通过整个模型](https://pytorch.org/tutorials/recipes/recipes/saving_and_loading_models_for_inference.html)

### 在 PyTorch 中保存和加载常规检查点

<img src="https://pytorch.org/tutorials/_static/img/thumbnails/cropped/saving-and-loading-general-checkpoint.PNG" width=20% />

[保存和加载用于推理或恢复训练的通用检查点模型有助于从上次停下的地方继续。在本节中,探索如何保存和加载多个检查点](https://pytorch.org/tutorials/recipes/recipes/saving_and_loading_a_general_checkpoint.html)

### 使用 PyTorch 在一个文件中保存和加载多个模型

<img src="https://pytorch.org/tutorials/_static/img/thumbnails/cropped/saving-multiple-models.PNG" width=20% />

[在本节中,了解保存和加载多个模型如何有助于重用您之前训练过的模型](https://pytorch.org/tutorials/recipes/recipes/saving_multiple_models_in_one_file.html)


### 使用 PyTorch 中不同模型的参数热启动模型

<img src="https://pytorch.org/tutorials/_static/img/thumbnails/cropped/warmstarting-models.PNG" width=20% />

[了解通过部分加载模型或加载部分模型来热启动训练过程如何帮助您的模型比从头开始训练更快地收敛](https://pytorch.org/tutorials/recipes/recipes/warmstarting_model_using_parameters_from_a_different_model.html)


### 在 PyTorch 中跨设备保存和加载模型

<img src="https://pytorch.org/tutorials/_static/img/thumbnails/cropped/saving-and-loading-models-across-devices.PNG" width=20% />

[了解如何使用 PyTorch 相对简单地跨设备(CPU 和 GPU)保存和加载模型](https://pytorch.org/tutorials/recipes/recipes/save_load_across_devices.html)


### 在 PyTorch 中将梯度归零

<img src="https://pytorch.org/tutorials/_static/img/thumbnails/cropped/zeroing-out-gradients.PNG" width=20% />

[了解何时应该将梯度归零以及这样做如何有助于提高模型的准确性](https://pytorch.org/tutorials/recipes/recipes/zeroing_out_gradients.html)


### PyTorch 基准测试

<img src="https://pytorch.org/tutorials/_static/img/thumbnails/cropped/profiler.png" width=20% />

[了解如何使用 PyTorch 的基准测试模块来测量和比较代码的性能](https://pytorch.org/tutorials/recipes/recipes/benchmark.html)


### PyTorch 基准测试(快速入门)

<img src="https://pytorch.org/tutorials/_static/img/thumbnails/cropped/profiler.png" width=20% />

[了解如何测量代码片段运行时间并收集指令](https://pytorch.org/tutorials/recipes/recipes/timer_quick_start.html)


### PyTorch Profiler

<img src="https://pytorch.org/tutorials/_static/img/thumbnails/cropped/profiler.png" width=20% />

[了解如何使用 PyTorch 的分析器来测量操作员的时间和内存消耗](https://pytorch.org/tutorials/recipes/recipes/profiler_recipe.html)

### PyTorch Profiler 具有仪器和跟踪技术 API (ITT API) 支持

<img src="https://pytorch.org/tutorials/_static/img/thumbnails/cropped/profiler.png" width=20% />

[了解如何将 PyTorch 的分析器与仪器和跟踪技术 API (ITT API) 结合使用,以可视化英特尔® VTune™ Profiler GUI 中的操作员标签](https://pytorch.org/tutorials/recipes/profile_with_itt.html)

### Torch 编译 IPEX 后端

<img src="https://pytorch.org/tutorials/_static/img/thumbnails/cropped/profiler.png" width=20% />

[了解如何使用 torch.compile IPEX 后端](https://pytorch.org/tutorials/recipes/torch_compile_backend_ipex.html)

### 在 PyTorch 中推理形状

<img src="https://pytorch.org/tutorials/_static/img/thumbnails/cropped/profiler.png" width=20% />

[了解如何使用元设备来推理模型中的形状](https://pytorch.org/tutorials/recipes/recipes/reasoning_about_shapes.html)

### 从检查点加载 nn.Module 的提示

<img src="https://pytorch.org/tutorials/_static/img/thumbnails/cropped/profiler.png" width=20% />

[了解从检查点加载 nn.Module 的技巧](https://pytorch.org/tutorials/recipes/recipes/module_load_state_dict_tips.html)

动态量化

将动态量化应用于简单的 LSTM 模型

PyTorch Mobile 性能秘诀

在移动设备(Android 和 iOS)上使用 PyTorch 的性能优化方法列表

自动混合精度

使用 torch.cuda.amp 缩短运行时间并节省 NVIDIA GPU 上的内存

性能调优指南

实现最佳性能的技巧

利用英特尔® 高级矩阵扩展

了解如何利用英特尔® 高级矩阵扩展

适用于 PyTorch 的英特尔® 扩展

推出适用于 PyTorch* 的英特尔® 扩展

适用于 PyTorch 的英特尔® 神经压缩器

使用英特尔® 神经压缩器对 PyTorch 进行易于使用的量化

使用 Flask 进行部署

了解如何使用 Flask(一种轻量级 Web 服务器)从经过训练的 PyTorch 模型快速设置 Web API

分析基于 PyTorch RPC 的工作负载

如何使用 PyTorch 分析器分析基于 RPC 的工作负载

动态量化

将动态量化应用于简单的 LSTM 模型

Mobile Recipes 的量化

了解如何减小模型大小并使其运行速度更快,同时又不会损失太多准确性

适用于 PyTorch 的英特尔® 神经压缩器

使用英特尔® 神经压缩器对 PyTorch 进行易于使用的量化

如何将 TensorBoard 与 PyTorch 结合使用

了解 TensorBoard 与 PyTorch 的基本用法,以及如何在 TensorBoard UI 中可视化数据

动态量化

将动态量化应用于简单的 LSTM 模型

用于部署的 TorchScript

了解如何以 TorchScript 格式导出经过训练的模型以及如何以 C++ 加载 TorchScript 模型并进行推理

使用 Flask 进行部署

了解如何使用 Flask(一种轻量级 Web 服务器)从经过训练的 PyTorch 模型快速设置 Web API

如何将 TensorBoard 与 PyTorch 结合使用

了解 TensorBoard 与 PyTorch 的基本用法,以及如何在 TensorBoard UI 中可视化数据



回到顶部