在jupyter notebook中安装使用pytorch

jupyter中torch库的安装与虚拟环境的搭建 进行卷积神经网络学习时,会利用到torch等一些列库,而且最好用GPU来进行运算。选择对应CUDA版本的PyTorch是很重要的,因为PyTorch需要CUDA来支持GPU加速。如果您安装了与您的CUDA版本不兼容的PyTorch,那么您将无法使用GPU进行训练或推理。 阅读详情
AI摘要

本文详细介绍了如何在Anaconda环境下创建名为DeepLearning的虚拟环境,包括检查并安装CUDA 10.1、CuDNN,下载并配置PyTorch 1.2.0,以及后续的ipykernel安装和环境写入。此外,还指导了如何在Jupyter Notebook中添加PyTorch环境,并列出了所需的相关软件包下载。

  1. 创建一个虚拟环境:DeepLearning
  2. 分别下载安装cuda(V10.1.243)、CuDNN、Pytorch(1.2.0)
  3. 在新环境中安装ipykernel: conda install ipykernel
  4. 写入环境: python -m ipykernel install --name DeepLearing --display-name "Pytorch for Deeplearning"
  5. 下载jupyter notebook : pip install matplotlib -i https://pypi.doubanio.com/simple
  6. 依次下载 numpy 、scipy 和 pandas以及matplotlib

本次博客是为了记录安装方法,很多步骤博主之前都已经安装好了,因此大多是直接复制咱贴其他博主的,链接如下,谢谢他们的帮助。
本文引用博客如下:
7. https://blog.csdn.net/petSym/article/details/105985650
8. https://blog.csdn.net/qq_37388085/article/details/107995147
9. https://blog.csdn.net/qq_23013309/article/details/103965619

一. 创建环境
在 Anaconda Prompt窗口中输入:conda create -n DeepLearning
进入环境:conda activate DeepLearning

二. 安装步骤
1.检查是否有合适的GPU, 若有安装Cuda与CuDNN

2.下载pytorch安装文件,进行pytorch的安装

检查电脑是否有合适的GPU
在桌面上右击如果

Jupyter以及pycharm如何使用pytorch jupyter配置pytorch 阅读详情

相关推荐

jupyter notebook 安装pytorch,导入torch库

报错: 原因:当前虚拟环境中无torch这个库 解决方案:切换到一个已经安装完torch库的虚拟环境。 搜索:“anaconda切换虚拟环境” 参考: Anaconda查看、创建、切换虚拟环境_AIHUBEI的博客-CSDN博客_anaconda切换虚拟环境 在终端输入语句: ①conda env list (为了查看当前已创建的环境) ②conda activate XXXXX (XXXXX为除base外的另一个虚拟环境,不同人的不一样。) 结果输入语句②切换虚拟环境时报错: .

m0_50108300的博客 1万+

Pycharm配置Jupyter Notebook并安装pytorch

最近在学pytorch,想用jupyter notebook。我的需求: pycharm主义者 讨厌conda pycharm使用pycharm创建的虚拟环境 在里面使用jupyter notebook 开始吧! 准备 Pycharm2019 专业版(学生账号提供邮箱可免费使用) 详细步骤 1、首先在pytorch中新建python项目 确保它会新建虚拟环境(venv文件夹),我这里是pyt...

明太烤土豆子的博客 1701

手把手教你为TI C2000 DSP(如28335)编写BootLoader:从Flash擦写到程序跳转的完整避坑指南

本文详细介绍了为TI C2000 DSP(如28335)编写BootLoader的完整流程,从Flash擦写到程序跳转的避坑指南。涵盖环境搭建、Flash操作安全实践、中断向量表管理、链接文件调整、通讯协议设计及量产化部署策略,帮助开发者构建工业级可靠的BootLoader系统,提升设备维护效率。

weixin_30825581的博客 427

Tlsr8258开发-程序烧写

开源一小步,进步一大步

自学嵌入式 1779

【AWS】创建aws云服务器EC2实例

本文介绍了如何创建aws的EC2云服务器,并介绍了如何使用Xshell远程连接上云服务器

Marcos921的博客 2506

VASP+Multiwfn+VMD静电势计算与可视化全流程解析

静电势是表征分子与材料表面电荷分布的关键物理量,它通过求解泊松方程,将电子密度与原子核电荷在空间中的贡献结合起来,直观揭示体系的电子富集与缺失区域。这一性质在理解化学反应活性、分子间相互作用(如氢键、卤键)以及材料表面性质方面具有重要价值。在计算材料科学与量子化学领域,基于第一性原理计算获得高精度电子结构数据后,如何将其转化为可直观分析的静电势图,是连接理论计算与物理解释的关键技术环节。本文聚焦于构建一条高效、可控的端到端工作流,详细解析如何利用VASP进行高精度电子密度计算,通过专业波函数分析软件Mult

weixin_33733810的博客 436

UM2 3D 打印机 DIY 实践 (2) 电路篇

涉及到的东西非常多,实际上后面还会讲到。主要部件清单: 主板 mega2560 + Ramps1.4 + LCD12864 各一张 42 x38mm x3,xyz 轴各一台 42 x23mm x1,用在挤出机 泰坦远程挤出机 x1 TMC2225 驱动板 x4, 替代a4988、TMC2208,静音效果好,性价比高 s-250-12v 20A开关电源 x1。功率必须足够大,宁可选大一点的 大功率 MOS 管,25A x1 NTC .

afeiqiang的专栏 3603

【大模型】DeepSeek 高级提示词技巧使用详解

DeepSeek 高级提示词技巧使用详解

congge 1万+

Modbus协议介绍及解析

Modbus协议介绍及解析 1.Modbus简介 Modbus是一种广泛应用于工业控制领域串行通信协议,以其开放性、高可靠性、高效简单性、免费等优点,成为了工业领域通信协议的业界标准,是工业现场电子设备之间常用的连接方式。Modbus按其格式可分为Modbus-RTU,Modbus-ASCII,Modbus-TCP,其中前两者适用于串行通信控制网络中,例如RS485,RS232等,而Modbus-TCP主要应用于基于以太网TCP/IP通信的控制网络中。通过此协议,控制器相互之间、或控制器和其它设备之间进行通

逍遥子的博客 1万+

115网页版VR模式终于能用了!电脑直接播放vr视频沉浸感满满 115vr播放 无需vr头盔播放vr视频 在线vr播放器 115网盘360度视频播放方法 115全景视频播放教程

油猴 + 脚本让你网页端直接开启 VR 模式支持 360 视频拖动视角,非常沉浸适合电脑设备直接用无需vr头盔也能轻松畅看vr视频,希望也能帮到你。如果你也被 115 的限制搞烦了,不妨试试这招。

代码简单说 Vue、JAVA、PHP、Node.js 熟练运用,接口、架构、性能全搞定。 5745

IDEA的使用指南

IDEA基于java的使用手册,可以最快速的上手,在使用中不断的丰富自己的使用技巧.

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

蓝牙模块HM-10手册

蓝牙模块HM-10手册,该手册对蓝牙模块HM-10进行了详细的介绍和使用方法以及一些AT指令。

上一篇: spyder更新为5.0后桌面图标消失
下一篇: Tensorboard打不开的解决方法
肉肉的求学路
博客等级 码龄6年 13粉丝 7原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址