diff --git a/source/_posts/AGI-Startup.md b/source/_posts/AGI-Startup.md
index 9a0ed7b..c18302c 100644
--- a/source/_posts/AGI-Startup.md
+++ b/source/_posts/AGI-Startup.md
@@ -6,6 +6,8 @@ index_img: /img/post_pics/ai/AGI.jpeg
tags:
- 算法
- AI
+ - CUDA
+ - Pytorch
categories:
- GPU
---
@@ -22,15 +24,9 @@ categories:
- [Cuda](#cuda)
- [Jetson 嵌入式AI](#jetson-嵌入式ai)
- [Github 资源](#github-资源)
-- [安装Pytorch 1.x 环境(CPU版本)](#安装pytorch-1x-环境cpu版本)
- - [Install Anaconda](#install-anaconda)
- - [Change resource urls](#change-resource-urls)
- - [Install Pytorch 1.x](#install-pytorch-1x)
- - [Another way to install Pytorch without Anaconda](#another-way-to-install-pytorch-without-anaconda)
-- [Windows配置Pytorch GPU环境](#windows配置pytorch-gpu环境)
- - [Cuda](#cuda-1)
- - [Conda](#conda)
- - [cuDNN](#cudnn)
+- [安装Pytorch 1.6 环境(CPU版本)](#安装pytorch-16-环境cpu版本)
+- [安装Pytorch 2.x环境(GPU版本)](#安装pytorch-2x环境gpu版本)
+- [VScode Pytorch Book 环境配置](#vscode-pytorch-book-环境配置)
- [CNN卷积神经网络](#cnn卷积神经网络)
- [FashionMNIST手写数字分类](#fashionmnist手写数字分类)
- [Cifar-10](#cifar-10)
@@ -41,10 +37,10 @@ categories:
| 链接 | 说明 |
| ---- | --- |
-| [《深度学习框架PyTorch:入门与实战》代码](https://github.com/chenyuntc/pytorch-book)|这个更基础,不过要安装1.x版本的pytorch,2.x版本的有一部分是不兼容的,最好电脑上安装Anaconda,然后创建一个torch的python虚拟环境,里面安装1.x的环境,用Jupyter打开里面的note,VSCODE也支持Jupyter插件,然后python解释器选择虚拟环境安装了torch的python|
+| [**《深度学习框架PyTorch:入门与实战》代码**](https://github.com/chenyuntc/pytorch-book)|这个更基础,不过要安装1.6版本的pytorch,2.x版本的有一部分是不兼容的,最好电脑上安装Anaconda,然后创建一个torch的python虚拟环境,里面安装1.x的环境,用Jupyter打开里面的note,VScode也支持Jupyter插件,然后python解释器选择虚拟环境安装了torch的python,参考[安装Pytorch 1.6 环境(CPU版本)](#安装pytorch-16-环境cpu版本)和[VScode Pytorch Book 环境配置](#vscode-pytorch-book-环境配置)|
| [Pytorch 官方文档](https://pytorch.org/tutorials/beginner/basics/intro.html) | 最新的是2.3版本,和下面教程搭配着看 |
| [Pytorch 官方文档教程仓库](https://github.com/pytorch/tutorials) | PyTorch tutorials。有点占地方,里面和文档内容对应,有直接可运行的脚本 |
-| [Pytorch 安装指引](https://pytorch.org/get-started/locally/)||
+| [Pytorch 安装指引](https://pytorch.org/get-started/locally/)| 安装CPU/CUDA版本 |
| [Pytorch 官方文档翻译版](https://github.com/apachecn/pytorch-doc-zh)| Pytorch 中文文档,缺点,广告太多 |
| [Pytorch Examples](https://github.com/pytorch/examples)| A set of examples around pytorch in Vision, Text, Reinforcement Learning, etc. |
| [Pytorch 源码仓库](https://github.com/pytorch/pytorch)| Tensors and Dynamic neural networks in Python with strong GPU acceleration |
@@ -61,51 +57,57 @@ categories:
### Github 资源
-| 仓库 |说明 | 重要指数 |
-| --------------------------------------- | ------------------ | -------- |
-| **1. AI/AGI/AIoT** | | |
-| [**HuggingFace/Transformers**](https://github.com/huggingface/transformers) | 著名论文[Attention Is All You Need](https://arxiv.org/abs/1706.03762) 提出的 Transformers 提供数千个预训练模型,用于执行不同模态(例如文本、视觉和音频)的任务。这些模型可应用于:
1. 📝 文本,用于 100 多种语言的文本分类、信息提取、问答、摘要、翻译和文本生成等任务。
2. 🖼️ 图像,用于图像分类、对象检测和分割等任务。
3. 🗣️ 音频,用于语音识别和音频分类等任务。
Transformers 模型还可以执行多种模态组合的任务,例如表格问答、光学字符识别、从扫描文档中提取信息、视频分类和视觉问答。 | ★★★★★ |
-| [HuggingFace/Pytorch image models](https://github.com/huggingface/pytorch-image-models) |最大的 PyTorch 图像 encoders / backbone 集合。包括训练、评估、推理、导出脚本和预训练权重 - ResNet、ResNeXT、EfficientNet、NFNet、Vision Transformer (ViT)、MobileNetV4、MobileNet-V3 & V2、RegNet、DPN、CSPNet、Swin Transformer、MaxViT、CoAtNet、ConvNeXt 等| ★ |
-| [HuggingFace/Datasets](https://github.com/huggingface/datasets) |Datasets 是一个轻量级库,提供两个主要功能:适用于许多公共数据集的单行数据加载器;高效的数据预处理。|★|
-| [HuggingFace/Accelerate](https://github.com/huggingface/accelerate) | Accelerate 是为那些喜欢编写 PyTorch 模型训练循环但不愿意编写和维护使用多 GPU/TPU/fp16 所需的样板代码的 PyTorch 用户创建的。 |★|
-| [**Google/Vision Transformer**](https://github.com/google-research/vision_transformer) |在这个存储库中,我们发布了论文中的模型
一张图片胜过 16x16 个单词:用于大规模图像识别的 Transformers
MLP-Mixer:用于视觉的全 MLP 架构
如何训练你的 ViT?视觉 Transformers 中的数据、增强和正则化
当视觉 Transformers 在没有预训练或强大的数据增强的情况下胜过 ResNets 时
LiT:使用锁定图像文本调整的零样本传输
替代间隙最小化改进了清晰度感知训练
这些模型在 ImageNet 和 ImageNet-21k 数据集上进行了预训练。我们在 JAX/Flax 中提供了用于微调已发布模型的代码。
| ★★★★★ |
-| [Stability-AI/Generative Models](https://github.com/Stability-AI/generative-models)| Generative Models by Stability AI | ★ |
-| [Stability-AI/Stable Diffusion](https://github.com/Stability-AI/stablediffusion) | 此存储库包含从头开始训练的 Stable Diffusion 模型,并将使用新的检查点不断更新。 | ★ |
-| [**AUTOMATIC1111/Stable Diffusion WebUI**](https://github.com/AUTOMATIC1111/stable-diffusion-webui)| 使用 Gradio 库实现的Stable Diffusion的 Web 界面。 [简体中文翻译扩展](https://github.com/dtlnor/stable-diffusion-webui-localization-zh_CN)| ★★★★★ |
-| [**Zhouyi-AIPU/Model Zoo**](https://github.com/Zhouyi-AIPU/Model_zoo)| 各种Embedded model汇总 | ★★★ |
-| [TensorFlow](https://github.com/tensorflow/tensorflow) | An Open Source Machine Learning Framework for Everyone | ★ |
-| [TensorFlow Models](https://github.com/tensorflow/models) | Models and examples built with TensorFlow | ★ |
-| [**Ultralytics/Yolov5**](https://github.com/ultralytics/yolov5)| YOLOv5🚀是世界上最受欢迎的视觉 AI,代表了 Ultralytics 对未来视觉 AI 方法的开源研究,融合了数千小时研发过程中获得的经验教训和最佳实践。| ★★★★★ |
-| [Ultralytics/ultralytics](https://github.com/ultralytics/ultralytics) | Ultralytics YOLOv8 是一款尖端的、最先进的 (SOTA) 模型,它以之前 YOLO 版本的成功为基础,并引入了新功能和改进,以进一步提高性能和灵活性。YOLOv8 旨在快速、准确且易于使用,使其成为各种对象检测和跟踪、实例分割、图像分类和姿势估计任务的绝佳选择。 | ★ |
-| [**Karpathy/llm.c**](https://github.com/karpathy/llm.c)| 简单、纯 C/CUDA 的 LLM,无需 245MB 的 PyTorch 或 107MB 的 cPython。当前重点是预训练,特别是重现 GPT-2 和 GPT-3 迷你剧,以及 train_gpt2.py 中的并行 PyTorch 参考实现。| ★★★★★ |
-| [Karpathy/llama2.c](https://github.com/karpathy/llama2.c)| 在 PyTorch 中训练 Llama 2 LLM 架构,然后使用一个简单的 700 行 C 文件 (run.c) 进行推理。 | ★ |
-| [GPT2-Chinese](https://github.com/Morizeyao/GPT2-Chinese)|中文的GPT2训练代码,使用BERT的Tokenizer或Sentencepiece的BPE model | ★ |
-| [openai-cookbook](https://github.com/openai/openai-cookbook)|使用 OpenAI API 完成常见任务的示例代码和指南。 | ★ |
-| [Dusty-nv/Jetson Inference](https://github.com/dusty-nv/jetson-inference)| 该项目使用 TensorRT 在 C++ 或 Python 的 GPU 上运行优化网络,并使用 PyTorch 训练模型。支持的 DNN 视觉基元包括用于图像分类的 imageNet、用于对象检测的 detectNet、用于语义分割的 segNet、用于姿势估计的 poseNet 和用于动作识别的 actionNet。提供了从实时摄像头源进行流式传输、使用 WebRTC 制作 Web 应用程序以及对 ROS/ROS2 的支持的示例。 | ★★★★★ |
-| [ONNX](https://github.com/onnx/onnx)|开放神经网络交换(ONNX)是一个开放的生态系统,使人工智能开发人员能够随着项目的发展选择合适的工具。ONNX为人工智能模型提供了一种开源格式,包括深度学习和传统ML,它定义了一个可扩展的计算图模型,以及内置运算符和标准数据类型的定义。目前我们专注于推理(评分)所需的功能。 | ★★★ |
-| [Microsoft/ONNX Runtime](https://github.com/microsoft/onnxruntime)|ONNX Runtime 是一个跨平台推理和训练机器学习加速器。|★|
-| [onnx-tensorrt](https://github.com/onnx/onnx-tensorrt) | 解析 ONNX 模型以便使用 [TensorRT](https://developer.nvidia.com/tensorrt) 执行。 NVIDIA® TensorRT™ 是一个用于高性能深度学习推理的 API 生态系统。TensorRT 包括推理运行时和模型优化,可为生产应用程序提供低延迟和高吞吐量。TensorRT 生态系统包括 TensorRT、TensorRT-LLM、TensorRT 模型优化器和 TensorRT Cloud。| ★★★|
-| [onnx-simplifier](https://github.com/daquexian/onnx-simplifier) | ONNX 很棒,但有时太复杂。 | ★ |
-| [tensorflow-onnx](https://github.com/onnx/tensorflow-onnx) | tf2onnx 通过命令行或 python api 将 TensorFlow(tf-1.x 或 tf-2.x)、keras、tensorflow.js 和 tflite 模型转换为 ONNX。 | ★ |
-| **2. GPU/CUDA/Rocm** | | |
-| [**CUDA-Learn-Notes**](https://github.com/DefTruth/CUDA-Learn-Notes)|CUDA-Learn-Notes: CUDA 笔记、大模型手撕CUDA、C++笔记 | ★★★★★ |
-| [**CUDA-Programming-Guide-in-Chinese**](https://github.com/HeKun-NVIDIA/CUDA-Programming-Guide-in-Chinese)| 本项目为 CUDA C Programming Guide 的中文翻译版。| ★ |
-| [NN-CUDA-Example](https://github.com/godweiyang/NN-CUDA-Example)|调用自定义 CUDA 运算符的神经网络工具包(PyTorch、TensorFlow 等)的几个简单示例。 | ★ |
-| [NVTrust](https://github.com/NVIDIA/nvtrust)|nvTrust 是一个存储库,其中包含在受信任的环境(例如机密计算)中使用 NVIDIA 解决方案时利用的许多实用程序和工具、开源代码和 SDK。 | ★ |
-| [ROCm/ROCT-Thunk-Interface](https://github.com/ROCm/ROCT-Thunk-Interface)|此存储库包含用于与 (AMD)ROCk 驱动程序交互的用户模式 API 接口。 | ★ |
-| **3. 免费资源** | | |
-| [**GitHub中文开源仓库排行榜**](https://github.com/GrowingGit/GitHub-Chinese-Top-Charts)| GitHub中文排行榜,帮助你发现优秀中文项目,可以无语言障碍地、更高效地吸收优秀经验成果 | ★★★ |
-| [free-programming-books](https://github.com/EbookFoundation/free-programming-books)| 多种语言的免费学习资源列表 | ★★★★★ |
-| [CS EBook](https://github.com/forthespada/CS-Books)| 超过1000本的计算机经典书籍分享,解压密码:a123654 | ★★★★ |
-| [CS EBook](https://github.com/lining808/CS-Ebook) | 本储存库是一些高质量的计算机科学与技术书籍推荐书单,需要学习的可以按照此书单进行学习进阶,包含了计算机大多数软件相关方向。而且敢承诺一直更新。 | ★★★ |
-
-## 安装Pytorch 1.x 环境(CPU版本)
+
+点击此处查看资源汇总
+
+| 仓库 |说明 |
+| --------------------------------------- | ------------------ |
+| **1. AI/AGI/AIoT** | |
+| [**HuggingFace/Transformers
★★★★★**](https://github.com/huggingface/transformers) | 著名论文[Attention Is All You Need](https://arxiv.org/abs/1706.03762) 提出的 Transformers 提供数千个预训练模型,用于执行不同模态(例如文本、视觉和音频)的任务。这些模型可应用于:
1. 📝 文本,用于 100 多种语言的文本分类、信息提取、问答、摘要、翻译和文本生成等任务。
2. 🖼️ 图像,用于图像分类、对象检测和分割等任务。
3. 🗣️ 音频,用于语音识别和音频分类等任务。
Transformers 模型还可以执行多种模态组合的任务,例如表格问答、光学字符识别、从扫描文档中提取信息、视频分类和视觉问答。 |
+| [**Karpathy/llm.c
★★★★★**](https://github.com/karpathy/llm.c)| 简单、纯 C/CUDA 的 LLM,无需 245MB 的 PyTorch 或 107MB 的 cPython。当前重点是预训练,特别是重现 GPT-2 和 GPT-3 迷你剧,以及 train_gpt2.py 中的并行 PyTorch 参考实现。|
+| [**Google/Vision Transformer
★★★★★**](https://github.com/google-research/vision_transformer) |在这个存储库中,我们发布了论文中的模型
一张图片胜过 16x16 个单词:用于大规模图像识别的 Transformers
MLP-Mixer:用于视觉的全 MLP 架构
如何训练你的 ViT?视觉 Transformers 中的数据、增强和正则化
当视觉 Transformers 在没有预训练或强大的数据增强的情况下胜过 ResNets 时
LiT:使用锁定图像文本调整的零样本传输
替代间隙最小化改进了清晰度感知训练
这些模型在 ImageNet 和 ImageNet-21k 数据集上进行了预训练。我们在 JAX/Flax 中提供了用于微调已发布模型的代码。
|
+| [**Ultralytics/Yolov5
★★★★★**](https://github.com/ultralytics/yolov5)| YOLOv5🚀是世界上最受欢迎的视觉 AI,代表了 Ultralytics 对未来视觉 AI 方法的开源研究,融合了数千小时研发过程中获得的经验教训和最佳实践。|
+| [**Dusty-nv/Jetson Inference
★★★★★**](https://github.com/dusty-nv/jetson-inference)| 该项目使用 TensorRT 在 C++ 或 Python 的 GPU 上运行优化网络,并使用 PyTorch 训练模型。支持的 DNN 视觉基元包括用于图像分类的 imageNet、用于对象检测的 detectNet、用于语义分割的 segNet、用于姿势估计的 poseNet 和用于动作识别的 actionNet。提供了从实时摄像头源进行流式传输、使用 WebRTC 制作 Web 应用程序以及对 ROS/ROS2 的支持的示例。 |
+| [**Stable Diffusion WebUI
★★★★★**](https://github.com/AUTOMATIC1111/stable-diffusion-webui)| 使用 Gradio 库实现的Stable Diffusion的 Web 界面。 [简体中文翻译扩展](https://github.com/dtlnor/stable-diffusion-webui-localization-zh_CN)|
+| [**Zhouyi-AIPU/Model Zoo
★★★**](https://github.com/Zhouyi-AIPU/Model_zoo)| 各种Embedded model汇总 |
+| [HuggingFace/Pytorch image models
★](https://github.com/huggingface/pytorch-image-models) |最大的 PyTorch 图像 encoders / backbone 集合。包括训练、评估、推理、导出脚本和预训练权重 - ResNet、ResNeXT、EfficientNet、NFNet、Vision Transformer (ViT)、MobileNetV4、MobileNet-V3 & V2、RegNet、DPN、CSPNet、Swin Transformer、MaxViT、CoAtNet、ConvNeXt 等|
+| [HuggingFace/Datasets
★](https://github.com/huggingface/datasets) |Datasets 是一个轻量级库,提供两个主要功能:适用于许多公共数据集的单行数据加载器;高效的数据预处理。|
+| [HuggingFace/Accelerate
★](https://github.com/huggingface/accelerate) | Accelerate 是为那些喜欢编写 PyTorch 模型训练循环但不愿意编写和维护使用多 GPU/TPU/fp16 所需的样板代码的 PyTorch 用户创建的。 |
+| [Stability-AI/Generative Models
★](https://github.com/Stability-AI/generative-models)| Generative Models by Stability AI |
+| [Stability-AI/Stable Diffusion
★](https://github.com/Stability-AI/stablediffusion) | 此存储库包含从头开始训练的 Stable Diffusion 模型,并将使用新的检查点不断更新。 |
+| [TensorFlow
★](https://github.com/tensorflow/tensorflow) | An Open Source Machine Learning Framework for Everyone |
+| [TensorFlow Models
★](https://github.com/tensorflow/models) | Models and examples built with TensorFlow |
+| [Ultralytics/ultralytics
★](https://github.com/ultralytics/ultralytics) | Ultralytics YOLOv8 是一款尖端的、最先进的 (SOTA) 模型,它以之前 YOLO 版本的成功为基础,并引入了新功能和改进,以进一步提高性能和灵活性。YOLOv8 旨在快速、准确且易于使用,使其成为各种对象检测和跟踪、实例分割、图像分类和姿势估计任务的绝佳选择。 |
+| [Karpathy/llama2.c
★](https://github.com/karpathy/llama2.c)| 在 PyTorch 中训练 Llama 2 LLM 架构,然后使用一个简单的 700 行 C 文件 (run.c) 进行推理。|
+| [GPT2-Chinese
★](https://github.com/Morizeyao/GPT2-Chinese)|中文的GPT2训练代码,使用BERT的Tokenizer或Sentencepiece的BPE model |
+| [openai-cookbook
★★](https://github.com/openai/openai-cookbook)|使用 OpenAI API 完成常见任务的示例代码和指南。 |
+| [ONNX
★★★](https://github.com/onnx/onnx)|开放神经网络交换(ONNX)是一个开放的生态系统,使人工智能开发人员能够随着项目的发展选择合适的工具。ONNX为人工智能模型提供了一种开源格式,包括深度学习和传统ML,它定义了一个可扩展的计算图模型,以及内置运算符和标准数据类型的定义。目前我们专注于推理(评分)所需的功能。 |
+| [Microsoft/ONNX Runtime
★](https://github.com/microsoft/onnxruntime)|ONNX Runtime 是一个跨平台推理和训练机器学习加速器。|
+| [onnx-tensorrt
★★](https://github.com/onnx/onnx-tensorrt) | 解析 ONNX 模型以便使用 [TensorRT](https://developer.nvidia.com/tensorrt) 执行。 NVIDIA® TensorRT™ 是一个用于高性能深度学习推理的 API 生态系统。TensorRT 包括推理运行时和模型优化,可为生产应用程序提供低延迟和高吞吐量。TensorRT 生态系统包括 TensorRT、TensorRT-LLM、TensorRT 模型优化器和 TensorRT Cloud。|
+| [onnx-simplifier
★](https://github.com/daquexian/onnx-simplifier) | ONNX 很棒,但有时太复杂。 |
+| [tensorflow-onnx
★](https://github.com/onnx/tensorflow-onnx) | tf2onnx 通过命令行或 python api 将 TensorFlow(tf-1.x 或 tf-2.x)、keras、tensorflow.js 和 tflite 模型转换为 ONNX。 |
+| **2. GPU/CUDA/Rocm** |
+| [**CUDA-Learn-Notes
★★★★★**](https://github.com/DefTruth/CUDA-Learn-Notes)|CUDA-Learn-Notes: CUDA 笔记、大模型手撕CUDA、C++笔记 |
+| [**CUDA-Programming-Guide-in-Chinese
★**](https://github.com/HeKun-NVIDIA/CUDA-Programming-Guide-in-Chinese)| 本项目为 CUDA C Programming Guide 的中文翻译版。|
+| [NN-CUDA-Example
★](https://github.com/godweiyang/NN-CUDA-Example)|调用自定义 CUDA 运算符的神经网络工具包(PyTorch、TensorFlow 等)的几个简单示例。 |
+| [NVTrust
★](https://github.com/NVIDIA/nvtrust)|nvTrust 是一个存储库,其中包含在受信任的环境(例如机密计算)中使用 NVIDIA 解决方案时利用的许多实用程序和工具、开源代码和 SDK。 |
+| [ROCm/ROCT-Thunk-Interface
★](https://github.com/ROCm/ROCT-Thunk-Interface)|此存储库包含用于与 (AMD)ROCk 驱动程序交互的用户模式 API 接口。 |
+| **3. 免费资源** | |
+| [**GitHub中文开源仓库排行榜
★★★★★**](https://github.com/GrowingGit/GitHub-Chinese-Top-Charts)| GitHub中文排行榜,帮助你发现优秀中文项目,可以无语言障碍地、更高效地吸收优秀经验成果 |
+| [**free-programming-books
★★★★★**](https://github.com/EbookFoundation/free-programming-books)| 多种语言的免费学习资源列表 |
+| [CS EBook
★★★](https://github.com/forthespada/CS-Books)| 超过1000本的计算机经典书籍分享,解压密码:a123654 |
+| [CS EBook
★★★](https://github.com/lining808/CS-Ebook) | 本储存库是一些高质量的计算机科学与技术书籍推荐书单,需要学习的可以按照此书单进行学习进阶,包含了计算机大多数软件相关方向。而且敢承诺一直更新。 |
+
+
+
+## 安装Pytorch 1.6 环境(CPU版本)
https://pytorch.org/get-started/previous-versions/
-### Install Anaconda
+
+点击此处查看步骤
-Anaconda download address: https://www.anaconda.com/download
+**安装 Anaconda. 下载地址:** https://www.anaconda.com/download
```bash
# For example, Ubuntu
@@ -120,41 +122,235 @@ $ conda --version
conda 24.1.2
```
-### Change resource urls
+**换源**
```bash
# Reference https://blog.csdn.net/adreammaker/article/details/123396951
-conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
-conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
-conda config --set show_channel_urls yes
+$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
+$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
+$ conda config --set show_channel_urls yes
+```
-conda create -n torch python=3.9
-conda activate torch-gpu
+**创建Pytorch虚拟环境**
+
+```bash
+$ conda create -n torch-1.6 python=3.6.13
+```
+
+
+创建过程的log
+
+```bash
+$ conda create -n torch-1.6 python=3.6.13
+Channels:
+ - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
+ - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
+ - defaults
+Platform: linux-64
+Collecting package metadata (repodata.json): done
+Solving environment: done
+
+## Package Plan ##
+
+ environment location: /home/shenjianliang/anaconda3/envs/torch-1.6
+
+ added / updated specs:
+ - python=3.6.13
+
+
+The following packages will be downloaded:
+
+ package | build
+ ---------------------------|-----------------
+ certifi-2021.5.30 | py36h06a4308_0 139 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
+ libffi-3.3 | he6710b0_2 50 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
+ openssl-1.1.1w | h7f8727e_0 3.7 MB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
+ pip-21.2.2 | py36h06a4308_0 1.8 MB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
+ python-3.6.13 | h12debd9_1 32.5 MB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
+ setuptools-58.0.4 | py36h06a4308_0 788 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
+ wheel-0.37.1 | pyhd3eb1b0_0 33 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
+ ------------------------------------------------------------
+ Total: 39.0 MB
+
+The following NEW packages will be INSTALLED:
+
+ _libgcc_mutex anaconda/pkgs/main/linux-64::_libgcc_mutex-0.1-main
+ _openmp_mutex anaconda/pkgs/main/linux-64::_openmp_mutex-5.1-1_gnu
+ ca-certificates anaconda/pkgs/main/linux-64::ca-certificates-2024.3.11-h06a4308_0
+ certifi anaconda/pkgs/main/linux-64::certifi-2021.5.30-py36h06a4308_0
+ ld_impl_linux-64 anaconda/pkgs/main/linux-64::ld_impl_linux-64-2.38-h1181459_1
+ libffi anaconda/pkgs/main/linux-64::libffi-3.3-he6710b0_2
+ libgcc-ng anaconda/pkgs/main/linux-64::libgcc-ng-11.2.0-h1234567_1
+ libgomp anaconda/pkgs/main/linux-64::libgomp-11.2.0-h1234567_1
+ libstdcxx-ng anaconda/pkgs/main/linux-64::libstdcxx-ng-11.2.0-h1234567_1
+ ncurses anaconda/pkgs/main/linux-64::ncurses-6.4-h6a678d5_0
+ openssl anaconda/pkgs/main/linux-64::openssl-1.1.1w-h7f8727e_0
+ pip anaconda/pkgs/main/linux-64::pip-21.2.2-py36h06a4308_0
+ python anaconda/pkgs/main/linux-64::python-3.6.13-h12debd9_1
+ readline anaconda/pkgs/main/linux-64::readline-8.2-h5eee18b_0
+ setuptools anaconda/pkgs/main/linux-64::setuptools-58.0.4-py36h06a4308_0
+ sqlite anaconda/pkgs/main/linux-64::sqlite-3.45.3-h5eee18b_0
+ tk anaconda/pkgs/main/linux-64::tk-8.6.14-h39e8969_0
+ wheel anaconda/pkgs/main/noarch::wheel-0.37.1-pyhd3eb1b0_0
+ xz anaconda/pkgs/main/linux-64::xz-5.4.6-h5eee18b_1
+ zlib anaconda/pkgs/main/linux-64::zlib-1.2.13-h5eee18b_1
+
+
+Proceed ([y]/n)? y
+
+
+Downloading and Extracting Packages:
+
+Preparing transaction: done
+Verifying transaction: done
+Executing transaction: done
+#
+# To activate this environment, use
+#
+# $ conda activate torch-1.6
+#
+# To deactivate an active environment, use
+#
+# $ conda deactivate
```
-### Install Pytorch 1.x
+
+
+**激活环境**
+
+```bash
+$ conda activate torch-1.6
+```
+
+**安装Pytorch 1.6**
+
+```bash
+$ conda install pytorch==1.6.0 torchvision==0.7.0 -c pytorch
+```
+
+
+安装的log
+
+```bash
+$ conda install pytorch==1.6.0 torchvision==0.7.0 -c pytorch
+Channels:
+ - pytorch
+ - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
+ - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
+ - defaults
+Platform: linux-64
+Collecting package metadata (repodata.json): done
+Solving environment: done
+
+## Package Plan ##
+
+ environment location: /home/shenjianliang/anaconda3/envs/torch-1.6
+
+ added / updated specs:
+ - pytorch==1.6.0
+ - torchvision==0.7.0
+
+
+The following packages will be downloaded:
+
+ package | build
+ ---------------------------|-----------------
+ cudatoolkit-10.2.89 | hfd86e86_1 365.1 MB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
+ giflib-5.2.1 | h5eee18b_3 80 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
+ intel-openmp-2022.1.0 | h9e868ea_3769 4.5 MB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
+ libgfortran-ng-7.5.0 | ha8ba4b0_17 22 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
+ libgfortran4-7.5.0 | ha8ba4b0_17 995 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
+ libwebp-1.2.4 | h11a3e52_1 86 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
+ libwebp-base-1.2.4 | h5eee18b_1 376 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
+ mkl-2022.1.0 | hc2b9512_224 129.7 MB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
+ ninja-1.10.2 | h06a4308_5 8 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
+ ninja-base-1.10.2 | hd09550d_5 109 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
+ numpy-1.14.2 | py36hdbf6ddf_0 3.2 MB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
+ olefile-0.46 | pyhd3eb1b0_0 34 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
+ pillow-8.3.1 | py36h5aabda8_0 638 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
+ pytorch-1.6.0 |py3.6_cuda10.2.89_cudnn7.6.5_0 537.3 MB pytorch
+ torchvision-0.7.0 | py36_cu102 11.0 MB pytorch
+ ------------------------------------------------------------
+ Total: 1.03 GB
+
+The following NEW packages will be INSTALLED:
+
+ blas anaconda/pkgs/main/linux-64::blas-1.0-mkl
+ cudatoolkit anaconda/pkgs/main/linux-64::cudatoolkit-10.2.89-hfd86e86_1
+ freetype anaconda/pkgs/main/linux-64::freetype-2.12.1-h4a9f257_0
+ giflib anaconda/pkgs/main/linux-64::giflib-5.2.1-h5eee18b_3
+ intel-openmp anaconda/pkgs/main/linux-64::intel-openmp-2022.1.0-h9e868ea_3769
+ jpeg anaconda/pkgs/main/linux-64::jpeg-9e-h5eee18b_1
+ lcms2 anaconda/pkgs/main/linux-64::lcms2-2.12-h3be6417_0
+ lerc anaconda/pkgs/main/linux-64::lerc-3.0-h295c915_0
+ libdeflate anaconda/pkgs/main/linux-64::libdeflate-1.17-h5eee18b_1
+ libgfortran-ng anaconda/pkgs/main/linux-64::libgfortran-ng-7.5.0-ha8ba4b0_17
+ libgfortran4 anaconda/pkgs/main/linux-64::libgfortran4-7.5.0-ha8ba4b0_17
+ libpng anaconda/pkgs/main/linux-64::libpng-1.6.39-h5eee18b_0
+ libtiff anaconda/pkgs/main/linux-64::libtiff-4.5.1-h6a678d5_0
+ libwebp anaconda/pkgs/main/linux-64::libwebp-1.2.4-h11a3e52_1
+ libwebp-base anaconda/pkgs/main/linux-64::libwebp-base-1.2.4-h5eee18b_1
+ lz4-c anaconda/pkgs/main/linux-64::lz4-c-1.9.4-h6a678d5_1
+ mkl anaconda/pkgs/main/linux-64::mkl-2022.1.0-hc2b9512_224
+ ninja anaconda/pkgs/main/linux-64::ninja-1.10.2-h06a4308_5
+ ninja-base anaconda/pkgs/main/linux-64::ninja-base-1.10.2-hd09550d_5
+ numpy anaconda/pkgs/main/linux-64::numpy-1.14.2-py36hdbf6ddf_0
+ olefile anaconda/pkgs/main/noarch::olefile-0.46-pyhd3eb1b0_0
+ pillow anaconda/pkgs/main/linux-64::pillow-8.3.1-py36h5aabda8_0
+ pytorch pytorch/linux-64::pytorch-1.6.0-py3.6_cuda10.2.89_cudnn7.6.5_0
+ torchvision pytorch/linux-64::torchvision-0.7.0-py36_cu102
+ zstd anaconda/pkgs/main/linux-64::zstd-1.5.5-hc292b87_2
+
+
+Proceed ([y]/n)? y
+
+
+Downloading and Extracting Packages:
+
+Preparing transaction: done
+Verifying transaction: done
+Executing transaction: done
+```
+
+
+
+**Conda删除环境**
```bash
-conda install pytorch==1.13.0 torchvision==0.14.0 torchaudio==0.13.0 cpuonly -c pytorch
+# 退出当前环境
+$ conda deactivate
+
+# 列出当前env
+$ conda env list
+# conda environments:
+#
+base /home/shenjianliang/anaconda3
+torch-1.6 * /home/shenjianliang/anaconda3/envs/torch-1.6
+
+# 删除
+$ conda env remove -p /home/shenjianliang/anaconda3/envs/torch-1.6
```
-### Another way to install Pytorch without Anaconda
+**不用Anaconda,使用python虚拟env**
```bash
-sudo apt-get install python3-venv
-python3.11 -m venv myenv
-source myenv/bin/activate
+$ sudo apt-get install python3-venv
+$ python3.11 -m venv myenv
+$ source myenv/bin/activate
-pip install torch==1.13.0+cpu torchvision==0.14.0+cpu torchaudio==0.13.0 --extra-index-url https://download.pytorch.org/whl/cpu
+$ pip install torch==1.13.0+cpu torchvision==0.14.0+cpu torchaudio==0.13.0 --extra-index-url https://download.pytorch.org/whl/cpu
```
-## Windows配置Pytorch GPU环境
+
+
+## 安装Pytorch 2.x环境(GPU版本)
在RTX4070S windows中配置WSL相关的AI环境,包括CUDA,PyTorch,Cudnn等
-### Cuda
+
+点击此处查看步骤
-安装WSL/Docker/Nvidia:
+**安装WSL/Docker/Nvidia:**
[Windows 下让 Docker Desktop 关联上 NVidia GPU](https://blog.csdn.net/ndscvipuser/article/details/136610169)
[如何查看wsl是wsl1还是wsl2](https://blog.csdn.net/dghcs18/article/details/134244426)
[Nvidia WSL官方指引](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html)
@@ -203,7 +399,7 @@ Cuda compilation tools, release 12.4, V12.4.131
Build cuda_12.4.r12.4/compiler.34097967_0
```
-### Conda
+**安装Conda**
```bash
#创建环境
@@ -223,9 +419,7 @@ conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch-nightl
conda activate torch-gpu
```
-### cuDNN
-
-下载安装方法:https://developer.nvidia.com/cudnn-downloads
+**安装cuDNN:https://developer.nvidia.com/cudnn-downloads**
```bash
wget https://developer.download.nvidia.com/compute/cudnn/9.2.0/local_installers/cudnn-local-repo-ubuntu2004-9.2.0_1.0-1_amd64.deb
@@ -238,12 +432,57 @@ sudo apt-get -y install cudnn-cuda-12
cat /usr/include/cudnn_version.h | grep CUDNN_MAJOR -A 2
```
+
+
+## VScode Pytorch Book 环境配置
+
+
+点击此处查看步骤
+
+```bash
+git clone git@github.com:chenyuntc/pytorch-book.git
+```
+
+VScode安装插件
+
+![](/img/post_pics/ai/torch-book-extension.png)
+
+Ctrl + P, Mac 应该是Command + P,输入`> Python`, 为python再次安装Jupyter扩展。
+
+![](/img/post_pics/ai/torch-book-extension2.png)
+
+此时打开任意一个note可以看到代码变成可以执行的框了:
+
+![](/img/post_pics/ai/torch-book-load-python.png)
+
+但是会显示torch未导入,切换为conda安装的python环境,点击快速修复, 选择其他的Jupyter内核
+
+![](/img/post_pics/ai/torch-book-load-python-2.png)
+
+选择python环境,找到conda路径下的python解释器
+
+![](/img/post_pics/ai/torch-book-load-python-3.png)
+![](/img/post_pics/ai/torch-book-load-python-4.png)
+
+完成后可以看到不报警告了
+
+![](/img/post_pics/ai/torch-book-load-python-5.png)
+
+点击左侧运行,弹出要安装pykernel包,点击安装完成后,可以在右上角看到环境和python版本,也可以点击此处继续更换环境
+
+![](/img/post_pics/ai/torch-book-load-python-6.png)
+
+
+
## CNN卷积神经网络
### FashionMNIST手写数字分类
Pytorch: [Quick Start](https://pytorch.org/tutorials/beginner/basics/quickstart_tutorial.html)
+
+训练测试步骤
+
1. 下载数据集
2. 数据预处理等[Data Tutorial](https://pytorch.org/tutorials/beginner/basics/data_tutorial.html)
3. 定义model,类型、层、前向函数和损失计算函数,并传递至device,如CPU或者CUDA,[Build Model](https://pytorch.org/tutorials/beginner/basics/buildmodel_tutorial.html)
@@ -331,4 +570,8 @@ with torch.no_grad():
+
+
### Cifar-10
+
+参考 [**《深度学习框架PyTorch:入门与实战》代码**](https://github.com/chenyuntc/pytorch-book) 2.2.4 小试牛刀:CIFAR-10分类。
diff --git "a/source/_posts/CUDA\342\200\224\342\200\224C.md" "b/source/_posts/CUDA\342\200\224\342\200\224C.md"
index 7e1dcc3..c0e4b52 100644
--- "a/source/_posts/CUDA\342\200\224\342\200\224C.md"
+++ "b/source/_posts/CUDA\342\200\224\342\200\224C.md"
@@ -8,7 +8,7 @@ tags:
- GPU
- CUDA
categories:
- - CUDA
+ - GPU
---
源码:
@@ -89,6 +89,15 @@ categories:
- [4.1 CUDA内存模型概述](#41-cuda内存模型概述)
- [4.1.1 内存层次结构的优点](#411-内存层次结构的优点)
- [4.1.2 CUDA内存模型](#412-cuda内存模型)
+ - [4.1.2.1 寄存器](#4121-寄存器)
+ - [4.1.2.2 本地内存](#4122-本地内存)
+ - [4.1.2.3 共享内存](#4123-共享内存)
+ - [4.1.2.4 常量内存](#4124-常量内存)
+ - [4.1.2.5 纹理内存](#4125-纹理内存)
+ - [4.1.2.6 全局内存](#4126-全局内存)
+ - [4.1.2.7 GPU缓存](#4127-gpu缓存)
+ - [4.1.2.8 CUDA变量声明总结](#4128-cuda变量声明总结)
+ - [4.1.2.9 静态全局内存](#4129-静态全局内存)
- [4.2 内存管理](#42-内存管理)
- [4.2.1 内存分配和释放](#421-内存分配和释放)
- [4.2.2 内存传输](#422-内存传输)
@@ -99,12 +108,23 @@ categories:
- [4.3 内存访问模式](#43-内存访问模式)
- [4.3.1 对齐与合并访问](#431-对齐与合并访问)
- [4.3.2 全局内存读取](#432-全局内存读取)
+ - [4.3.2.1 缓存加载](#4321-缓存加载)
+ - [4.3.2.2 没有缓存的加载](#4322-没有缓存的加载)
+ - [4.3.2.3 非对齐读取的示例](#4323-非对齐读取的示例)
+ - [4.3.2.4 只读缓存](#4324-只读缓存)
- [4.3.3 全局内存写入](#433-全局内存写入)
- [4.3.4 结构体数组与数组结构体](#434-结构体数组与数组结构体)
- [4.3.5 性能调整](#435-性能调整)
+ - [4.3.5.1 展开技术](#4351-展开技术)
+ - [4.3.5.2 增大并行性](#4352-增大并行性)
- [4.4 核函数可达到的带宽](#44-核函数可达到的带宽)
- [4.4.1 内存带宽](#441-内存带宽)
- [4.4.2 矩阵转置问题](#442-矩阵转置问题)
+ - [4.4.2.1 为转置核函数设置性能的上限和下限](#4421-为转置核函数设置性能的上限和下限)
+ - [4.4.2.2 朴素转置:读取行与读取列](#4422-朴素转置读取行与读取列)
+ - [4.4.2.3 展开转置:读取行与读取列](#4423-展开转置读取行与读取列)
+ - [4.4.2.4 对角转置:读取行与读取列](#4424-对角转置读取行与读取列)
+ - [4.4.2.5 使用瘦块来增加并行性](#4425-使用瘦块来增加并行性)
- [4.5 使用统一内存的矩阵加法](#45-使用统一内存的矩阵加法)
- [4.6 总结](#46-总结)
- [第5章 共享内存和常量内存](#第5章-共享内存和常量内存)
diff --git "a/source/_posts/CUDA\342\200\224\342\200\224CUDA\345\271\266\350\241\214\347\250\213\345\272\217\350\256\276\350\256\241.md" "b/source/_posts/CUDA\342\200\224\342\200\224CUDA\345\271\266\350\241\214\347\250\213\345\272\217\350\256\276\350\256\241.md"
index 2b873ac..33fe52e 100644
--- "a/source/_posts/CUDA\342\200\224\342\200\224CUDA\345\271\266\350\241\214\347\250\213\345\272\217\350\256\276\350\256\241.md"
+++ "b/source/_posts/CUDA\342\200\224\342\200\224CUDA\345\271\266\350\241\214\347\250\213\345\272\217\350\256\276\350\256\241.md"
@@ -8,7 +8,7 @@ tags:
- GPU
- CUDA
categories:
- - CUDA
+ - GPU
---
## 目录
diff --git a/themes/fluid/source/img/post_pics/ai/conda.png b/themes/fluid/source/img/post_pics/ai/conda.png
new file mode 100644
index 0000000..8738769
Binary files /dev/null and b/themes/fluid/source/img/post_pics/ai/conda.png differ
diff --git a/themes/fluid/source/img/post_pics/ai/torch-book-extension.png b/themes/fluid/source/img/post_pics/ai/torch-book-extension.png
new file mode 100644
index 0000000..7644bb5
Binary files /dev/null and b/themes/fluid/source/img/post_pics/ai/torch-book-extension.png differ
diff --git a/themes/fluid/source/img/post_pics/ai/torch-book-extension2.png b/themes/fluid/source/img/post_pics/ai/torch-book-extension2.png
new file mode 100644
index 0000000..1b2f441
Binary files /dev/null and b/themes/fluid/source/img/post_pics/ai/torch-book-extension2.png differ
diff --git a/themes/fluid/source/img/post_pics/ai/torch-book-load-python-2.png b/themes/fluid/source/img/post_pics/ai/torch-book-load-python-2.png
new file mode 100644
index 0000000..7885ca0
Binary files /dev/null and b/themes/fluid/source/img/post_pics/ai/torch-book-load-python-2.png differ
diff --git a/themes/fluid/source/img/post_pics/ai/torch-book-load-python-3.png b/themes/fluid/source/img/post_pics/ai/torch-book-load-python-3.png
new file mode 100644
index 0000000..8e34d3f
Binary files /dev/null and b/themes/fluid/source/img/post_pics/ai/torch-book-load-python-3.png differ
diff --git a/themes/fluid/source/img/post_pics/ai/torch-book-load-python-4.png b/themes/fluid/source/img/post_pics/ai/torch-book-load-python-4.png
new file mode 100644
index 0000000..86be011
Binary files /dev/null and b/themes/fluid/source/img/post_pics/ai/torch-book-load-python-4.png differ
diff --git a/themes/fluid/source/img/post_pics/ai/torch-book-load-python-5.png b/themes/fluid/source/img/post_pics/ai/torch-book-load-python-5.png
new file mode 100644
index 0000000..b8d9eb6
Binary files /dev/null and b/themes/fluid/source/img/post_pics/ai/torch-book-load-python-5.png differ
diff --git a/themes/fluid/source/img/post_pics/ai/torch-book-load-python-6.png b/themes/fluid/source/img/post_pics/ai/torch-book-load-python-6.png
new file mode 100644
index 0000000..b65b7b4
Binary files /dev/null and b/themes/fluid/source/img/post_pics/ai/torch-book-load-python-6.png differ
diff --git a/themes/fluid/source/img/post_pics/ai/torch-book-load-python.png b/themes/fluid/source/img/post_pics/ai/torch-book-load-python.png
new file mode 100644
index 0000000..686a55f
Binary files /dev/null and b/themes/fluid/source/img/post_pics/ai/torch-book-load-python.png differ