PyTorch

《动手学深度学习 Pytorch版》 5.4 自定义层

5.4.1 不带参数的层 import torch import torch.nn.functional as F from torch import nn class CenteredLayer(nn.Module): def __init__(self): super().__init__() ......
深度 Pytorch 5.4

TensorFlow PyTorch Transformer --GPT

你是机器学习专家,请为我解答如下疑问: tensorflow,pytorch分别是什么?他们跟numpy的区别是什么?什么是深度学习,深度学习框架中的框架指的是什么?什么是机器学习,什么是transformer?transformer和tensorflow,pytorch的关系是什么? ChatGP ......
Transformer TensorFlow PyTorch GPT

ultralytics pytorch gpu版本安装

安装支持 GPU 版本的 Pytorch 首先安装 ultraytics python -m venv venv source venv/Scripts/activate pip install ultralytics python main.py 首先安装上面的 ultralytics,但是无法调 ......
ultralytics pytorch 版本 gpu

ubuntu16.04安装cuda8.0+pytorch1.0.0

1.安装cuda 1.1 查看ubuntu的英伟达显卡驱动 nvidia-smi 得到 驱动版本是384.130,比较老,所以需要下载旧版本的cuda 1.2 查看显卡是否支持CUDA计算 然后去到这里https://developer.nvidia.com/cuda-gpus查看你的显卡是否在表中 ......
pytorch1 pytorch ubuntu 16.04 cuda8

《动手学深度学习 Pytorch版》 5.3 延后初始化

import torch from torch import nn from d2l import torch as d2l 下面实例化的多层感知机的输入维度是未知的,因此框架尚未初始化任何参数,显示为“UninitializedParameter”。 net = nn.Sequential(nn. ......
深度 Pytorch 5.3

Pytorch深度学习零基础入门知识

DL 跑代码必须知道的事情 损失值 损失值的大小用于判断是否收敛,比较重要的是有收敛的趋势,即验证集损失不断下降,如果验证集损失基本上不改变的话,模型基本上就收敛了。 损失值的具体大小并没有什么意义,大和小只在于损失的计算方式,并不是接近于0才好。如果想要让损失好看点,可以直接到对应的损失函数里面除 ......
入门知识 深度 Pytorch 基础 知识

《动手学深度学习 Pytorch版》 5.2 参数管理

import torch from torch import nn net = nn.Sequential(nn.Linear(4, 8), nn.ReLU(), nn.Linear(8, 1)) X = torch.rand(size=(2, 4)) net(X) tensor([[-0.3771 ......
深度 参数 Pytorch 5.2

《动手学深度学习 Pytorch版》 5.1 层和块

层: 接收一组输入 生成相应输出 由一组可调整参数描述 块: 可以描述单个层、由多个层组成的组件或整个模型本身 讨论“比单个层大”但是“比整个模型小”的组件“块”更有价值 从编程的角度看,块由类表示 块必须具有反向传播函数 # 以前章多层感知机的代码为例 import torch from torc ......
深度 Pytorch 5.1

pip 安装pytorch

一、新建虚拟环境 二、激活虚拟环境 三、配置清华镜像源 四、在Pytorch官网:PyTorch 选择相关配置 ......
pytorch pip

PyTorch安装记录

1. 打开PyTorch官网,选择get started https://pytorch.org/ ![p1](https://img2023.cnblogs.com/blog/1809921/202309/1809921-20230908210617363-598618424.png) 2. 查看 ......
PyTorch

旧台式机配置pytorch环境

1、 (base) C:\Users\Administrator> (base) C:\Users\Administrator> (base) C:\Users\Administrator>conda create -n wind_2023 python==3.7 Collecting packag ......
台式机 台式 pytorch 环境

转:pytorch RoIAlign函数的用法

图解 RoIAlign 以及在 PyTorch 中的使用(含代码示例)_虾米小馄饨的博客-CSDN博客 如何在你自己的代码中使用ROI Pool和ROI Align(PyTorch 1.0)_ronghuaiyang的博客-CSDN博客 ......
函数 RoIAlign pytorch

Proj CDeepFuzz Paper Reading: PyTorch: an imperative style, high-performance deep learning library

## Abstract 本文: PyTorch Task: detail the implementation and architecture of PyTorch Github: https://github.com/pytorch/pytorch 特点: 1. PyTorch同时关注可用性和速 ......

《动手学深度学习 Pytorch版》 4.10 实战Kaggle比赛:预测比赛

# 4.10.1 下载和缓存数据集 ```python import hashlib import os import tarfile import zipfile import requests #@save DATA_HUB = dict() DATA_URL = 'http://d2l-dat ......
实战 深度 Pytorch Kaggle 4.10

《动手学深度学习 Pytorch版》 4.9 环境和分布偏移

# 4.9.1 分布偏移的类型 整节理论,详见书本。 # 4.9.2 分布偏移示例 整节理论,详见书本。 # 4.9.3 分布偏移纠正 整节理论,详见书本。 # 4.9.4 学习问题的分类法 整节理论,详见书本。 # 4.9.5 机器学习中的公平、责任和透明度 整节理论,详见书本。 # 练习 (1) ......
深度 Pytorch 环境 4.9

《动手学深度学习 Pytorch版》 4.8 数值稳定性和模型初始化

# 4.8.1 梯度消失和梯度爆炸 整节理论,详见书本。 1. 梯度消失 ```python %matplotlib inline import torch from d2l import torch as d2l x = torch.arange(-8.0, 8.0, 0.1, requires_ ......
数值 稳定性 深度 模型 Pytorch

《动手学深度学习 Pytorch版》 4.7 前向传播、反向传播和计算图

# 4.7.1 前向传播 整节理论,详见书本。 # 4.7.2 前向传播计算图 整节理论,详见书本。 # 4.7.3 反向传播 整节理论,详见书本。 # 4.7.4 训练神经网络 整节理论,详见书本。 # 练习 (1)假设一些标量函数 $X$ 的输入 $X$ 是 $n\times m$ 矩阵。$f$ ......
深度 Pytorch 4.7

《动手学深度学习 Pytorch版》 4.6 暂退法

```python import torch from torch import nn from d2l import torch as d2l ``` # 4.6.1 重新审视过拟合 整节理论,详见书本。 # 4.6.2 扰动的稳健性 整节理论,详见书本。 # 4.6.3 实践中的暂退法 整节理论 ......
深度 Pytorch 4.6

《动手学深度学习 Pytorch版》 4.5 权重衰减

# 4.5.1 范数与权重衰减 整节理论,详见书本。 # 4.5.2 高维线性回归 ```python %matplotlib inline import torch from torch import nn from d2l import torch as d2l ``` ```python # ......
权重 深度 Pytorch 4.5

关于包mamba安装和官网pytorch安装顺序的问题(基于anaconda)

如题,有以下几点需要特别注意: 1.对于anaconda,base环境旨在维护依赖关系,所以强烈建议不要在base环境中安装任何其他东西,因为可能会中断安装或者出现别的问题。实践证明,在base环境中安装mamba包,就算安装到天荒地老,也装不上,哈哈!!! 2.在虚拟环境中如果要用官方代码安装最新 ......
顺序 anaconda pytorch 问题 mamba

pytorch分布式训练报错:Duplicate GPU detected : rank 1 and rank 0 both on CUDA device 35000

之前使用的比较老的torch 1.8.1,换到torch 2.0后报错 "rank 1 and rank 0 both on CUDA device 35000" 将main函数开头部分的初始化 ```python distributed.init_process_group(backend='nc ......
分布式 rank Duplicate detected pytorch

循环神经网络--基于pytorch框架

import matplotlib.pyplot as plt import math import torch from torch import nn from torch.nn import functional as f from d2l import torch as d2l batch_ ......
神经网络 框架 神经 pytorch 网络

pytorch优化器

#torch.optim.SGD 常用参数列表: params 需要学习的参数 lr 学习率 momentum 冲量 加入冲量后权重更新公式由v=−dx∗lr+v变成v=−dx∗lr+v∗momemtum weight_decay 权重衰减 防止过拟合,原理见[这里](https://zhuanla ......
pytorch

量化自定义PyTorch模型入门教程

在以前Pytorch只有一种量化的方法,叫做“eager mode qunatization”,在量化我们自定定义模型时经常会产生奇怪的错误,并且很难解决。但是最近,PyTorch发布了一种称为“fx-graph-mode-qunatization”的方方法。在本文中我们将研究这个fx-graph- ......
入门教程 模型 PyTorch 教程

自定义CUDA实现PyTorch算子的四种简单方法

### 背景 在探索新的深度学习算法的时候,我们可能会遇到PyTorch提供的算子不能满足需求的情况,这时候就需要自定义PyTorch算子,将我们的算法集成到PyTorch的工作流中。同时,为了提高运算效率,算子往往都需要使用CUDA实现。所幸,PyTorch及很多其他Python库都提供了简化这一 ......
算子 PyTorch 方法 CUDA

Proj CDeepFuzz Paper Reading: Automatic differentiation in PyTorch

## Abstract 本文:描述automatic differentiation module of PyTorch 包括:Lua Torch, Chainer, HIPS Autograd Task: Provides a high-performance environment on dif ......

《动手学深度学习 Pytorch版》 4.4 模型选择、欠拟合和过拟合

# 4.4.1 训练误差和泛化误差 整节理论,详见书本。 # 4.4.2 模型选择 整节理论,详见书本。 # 4.4.3 欠拟合还是过拟合 整节理论,详见书本。 # 4.4.4 多项回归 ```python import math import numpy as np import torch fr ......
深度 模型 Pytorch 4.4

《动手学深度学习 Pytorch版》 4.3 多层感知机的简洁实现

```python import torch from torch import nn from d2l import torch as d2l ``` # 模型 ```python net = nn.Sequential(nn.Flatten(), nn.Linear(784, 256), nn. ......
多层 深度 Pytorch 4.3

《动手学深度学习 Pytorch版》 4.2 多层感知机的从零开始实现

```python import torch from torch import nn from d2l import torch as d2l # 经典数据集与batch size batch_size = 256 train_iter, test_iter = d2l.load_data_fas ......
多层 深度 Pytorch 4.2