Never stop learning, approaching the AI
  • 😄About
  • 🅰️AI-Candy on YouTube
    • 🎬YouTube 视频列表
    • 💠AI项目本地部署
      • 1️⃣安装 Pytorch 运行环境
      • 2️⃣在Python虚拟环境下使用 VS Code or PyCharm
        • VS Code Python format
      • 3️⃣Create python virtual environment in Linux
    • 👽AI 入门系列课程
      • 0️向量及向量运算
        • Reshape array code
      • 1️人工智能,机器学习,深度学习 和神经网络的区别
      • 2️卷积神经网络(CNN)
        • 3D CNN sample code
      • 3️Transformer 原理
      • 4️前馈神经网络 (FNN)
  • 🎭Artificial intelligence
    • 1️⃣Deep learning / machine learning
      • 👉Deep Learning Resources
      • 👉Deep learning notes
    • 2️⃣Python
      • Youtube音乐下载
      • Pytorch 安装环境配置 (old)
        • TorchEEG
      • Anaconda3 Python path
      • Data
      • IEEE-754 Floating Point Converter
        • ieee 754 conversion function
      • 文件读写
      • 文本清理
      • Python 下载在线视频
      • 修改Jupyter Notebook 默认工作目录
    • 3️⃣AI Websites
  • 🪤Programming
    • SQL
      • Delete data and reset auto-increment ID
    • Angular
      • Angular-datatables, dd/MM/yyyy, sorting (no paged list)
      • Datatables save state using localStorage
      • Variable storage method
      • Colour picker
      • Error fix for click columns on Datatable
      • Auto address use Google place
      • Auto address use Azure Maps
      • Upload file to Server
      • Validators.required OnChange input
      • Date, Time field
      • VS Code: Auto add missing imports when save
      • Datatable setting
      • Date time format
      • sticky <th> and <td> content
      • Filter booked time
      • Dropdown time selection with interval
      • Angular date online test
      • Updating data without refreshing the page
      • Object array sort and sum
      • Multi-type of columns use in one column
      • Select button for datatables
      • Switch button and event
      • Delete column from Array
      • Three-layer structure
      • Remove shadow when print mat-dialog content
      • JSON Parse && Object Array
      • Detect unused import in Typescript
      • Change location using radio button
      • display multi line message in the Toastr
      • Custom LOCALE_ID
      • Batch add data from csv to API server
        • Angular read csv and upload to Server
      • USB Port reader Web solution
      • Debug Angular app using JavaScript Debugger in VS Code
      • Skills
        • FormData & FormGroup to JSON
        • Dropdown list (customer)
        • Get current datetime
        • Get first day of year, month, and date
        • Call a function in a forEach loop
        • disable and readonly
        • Form element value
        • HTML input type
        • Input pattern (validation)
      • Display pipe (UI format)
        • Input upper case and button checked
        • Icons (Bootstrap and CoreUI)
        • Page Refresh
        • Selection list (two ways)
        • onChange Selection event
        • Random Password and Toggle
        • Password match
        • Select checkbox disable
      • Print and save to PDF
      • Import JS into Angular
      • LocalStorage
      • Angular DataTable
        • Data sort
        • A sample usage
        • Angular DataTable server side big data query
      • Change chart.js chart type
      • Angular UI - .NET API - .NET Auth
      • Angular - .NET API
      • *ngIf else && change to @if
      • Angular add reCAPTCHA v3 (Google)
      • Angular update
        • Update from v13 to v15
        • Update from v15 to v18
      • Angular application version central
      • Face detection
        • Face-api.js
      • Angular, Node version compatibility matrix
      • Clear cache
      • Angular oauth2 OIDC
      • Angular add header
    • .NET Skills
      • Add ID manually
      • Auto Mapping
        • Ignore Nesting
        • Startup setting
        • Datetime processing in AutoMapping
        • AutoMapper example
      • Validation filter
      • BaseController
      • Group by many
      • Database first, scaffold to class
      • Log setting and exception handler
      • Update appsetting.json value
      • Azure service bus message (queue)
      • Read appsetting.json value
      • Auth get user info by email
      • Azure Time zone
      • .NET API Add Service
      • Object comparison
      • Coravel Schedule
        • Read appsettings.json
      • .Net Core RDLC Report, Coravel and Email
      • Check Network and SQL server connections.
      • Datatime custom format
      • Many to Many EF
        • Many to Many CheckBox
      • PDFpig: Send Email with PDF attachment
      • .NET Core Middleware order
      • .NET API add Worker Service
      • .NET Router
      • Partial columns update
      • Add and Delete
      • 图片自适应宽度
      • ASP.NET Identity
      • Upload file to Azure
        • Upload file to Blob
      • Developer Guide
      • Code first one-many
      • ASP.NET MVC 5 Custom Error Page
      • VS can't debug
      • 通过邮编查 NSW COVID-19 感染人数
      • Jquery File Upload
      • Jquery Datepicker
      • ajax delete file from server
      • Autofac in MVC
      • Autofac in .NET Core
      • .NET Core
      • HTTP Return code
      • IdentityServer4
    • Power BI
      • Add parameter to PowerBI report
      • Convert UTC to Local time
      • Python in PowerBI
        • IEEE-754 conversion
      • PowerBI embed app - Server
      • PowerBI embed app - Client
        • Setting on portal
    • Azure service
      • Key Vault
      • Service bus - queue
      • Power Automate
      • Kusto Query Language
      • Azure Data Explorer
      • Reserved keyword on Azure Error
      • SQL Azure time convert
    • Azure blob
      • Azure blob setting
      • Display image from Blob
      • Upload image to Blob through .NET API
    • Html Bootstrap Icon, colour, size
      • Html spacing
      • Html text alignment
    • Video stream - JsMpeg
      • SSL - generate key
      • Client (SSL)
      • Websocket-Server (SSL)
      • Play RTSP video stream
    • ⏰Time Zone
      • datetime-local set date range
      • 🕐Get data by local time (UI, API)
      • 🕑Add offset hours for local UI and report
      • 🕒UTC time and Datetime convert
      • 🕓Angular - Timezone selection
      • 🕔Angular - Convert UTC to local time
      • 🕕C# Time Zone
  • >>>>>>>>>>>>>>>>>>>>>>>>>>>>
  • 🪜Apps and Skills
    • 1️Windows system app skills
      • Brother HL-2130 打印机 Toner 报警
      • VS Code 快捷键
      • Check SHA256 on windows
      • blob 视频下载
      • Photoshop 制作证件照片
      • 获取 Windows Key
      • 10进制36进制互转
      • Error when publish to Azure
      • Disable windows automatic update
      • Outlook setup for Yahoo Email
      • IIS setting
      • Windows 8/10, IIS Service
      • 安装程序出错 2052,2053 报警
      • 6 Yao Chinese UI
    • 2️Linux command
    • 3️Git command
    • 4️Bitbucket
    • 5️Gitbook Skills
    • 6️GitHub Desktop
    • 7️⃣EndNote
      • EndNote V21
      • Endnote使用技巧
      • 批量删除/修改Endnote 中 notes 栏内容
  • Android mobile connect PC
  • 💎USEFUL LINKS
    • 1️Coding websites
      • Website links
    • 2️Windows 平台工具,网站
    • 3️PotPlayer 设置
  • >>>>>>>>>>>>>>>>>>>>>>>>>>>>
  • 🚩Research >>EEG
    • 1️EEG基本知识的理论介绍
      • EEG 简介
      • EEG 的节律信号
      • EEG电极帽
      • EEG 伪迹
      • ERP 介绍
      • ERP 成分
      • EEG 数据分析软件
    • 2️LSL 应用
    • 3️EEG公开数据集汇总整理
    • 4️REDCap
      • Migration (Export & Import)
    • 5️⃣ScaneR
  • ☕Buy me a coffee
Powered by GitBook
On this page
  • 建立环境
  • 安装CUDA Toolkit and NVIDIA Driver
  • 安装 pytorch

Was this helpful?

  1. Artificial intelligence
  2. Python

Pytorch 安装环境配置 (old)

PreviousYoutube音乐下载NextTorchEEG

Last updated 1 year ago

Was this helpful?

建立环境

  1. 建立一个新环境 name = pytorch

    conda create -n pytorch python

  2. 进入 pytorch 工作环境 conda activate pytorch

  3. 查看安装包 pip list

  4. 查询显卡型号:

    任务管理器中,查看 Geforce GTX 950M https://developer.nvidia.com/cuda-gpus

    查看驱动版本: C:\Program Files\NVIDIA Corporation\NVSMI>nvidia-smi.exe

    Driver Version: 388.57 ==>需要升级驱动 https://developer.nvidia.com/drive/downloads

查看驱动版本:check graphic card and driver both suppot the CUDA varsion

cd C:\Program Files\NVIDIA Corporation\NVSMIconda //windows

nvidia-smi.exe

   NVIDIA-SMI version: 512.15
   Card type: NVIDIA GeForce 
   CUDA Version: 11.6

Check Compute Capabilities:

### CUDA Toolkit version need match Card Driver Version 
	
	CUDA 12.0.x     >=527.41 (Windows Driver)
	CUDA 11.6.x     >=452.39 (Windows Driver)

| NVIDIA-SMI 512.15 Driver Version: 512.15 === CUDA Version: 11.6 |

安装CUDA Toolkit and NVIDIA Driver

安装 pytorch

  1. 选择系统,软件包,下载版本,产生下载安装命令 https://pytorch.org/get-started/locally/

Anaconda Prompt (anaconda3)

conda install pytorch torchvision torchaudio pytorch-cuda=11.6 -c pytorch -c nvidia

Why pip install does not working?

pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu117

查询是否有torch

// Run Anaconda Prompt 
 (base) conda activate pytorch      ## activate pytorch env
 (pytorch) python
 >>import torch                    ## 查看是否可以使用GPU 
 >>torch.cuda.is_available() 
    
 >>torch.version.cuda
    

The solution of GPU is not available )

Method 1: Run Anaconda Navigator, Launch JupyterLab

Method 2: Run Anaconda Prompt (Anaconda3) -- entry command, then run jupyterlab.bat jupyterlab.bat: D:\ProgramData\Anaconda3\python.exe d:\ProgramData\Anaconda3\cwp.py d:\ProgramData\Anaconda3 d:\ProgramData\Anaconda3\python.exe d:\ProgramData\Anaconda3\Scripts\jupyter-lab-script.py "%USERPROFILE%/"

pip install torch-scatter torch-sparse torch-cluster torch-spline-conv torch-geometric -f https://data.pyg.org/whl/torch-1.13.0+cu117.html
torch.cuda.device_count()      // 
torch.cuda.current_device() 
torch.cuda.device(0) 
torch.cuda.get_device_name(0)
torch.zeros(1).cuda()      // 

# setting device on GPU if available, else CPU
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
print('Using device:', device)
print()

#Additional Info when using cuda
if device.type == 'cuda':
    print(torch.cuda.get_device_name(0))
    print('Memory Usage:')
    print('Allocated:', round(torch.cuda.memory_allocated(0)/1024**3,1), 'GB')
    print('Cached:   ', round(torch.cuda.memory_reserved(0)/1024**3,1), 'GB')

## check torch version //v1.11

print(torch.version) // in jupyter python -c "import torch; print(torch.version)"

##To move tensors to the respective device: torch.rand(10).to(device)

##To create a tensor directly on the device: torch.rand(10, device=device)

// install torch geometric

   refer to:  https://pytorch-geometric.readthedocs.io/en/latest/notes/installation.html
   conda install pyg -c pyg    //conda
   pip install torch-scatter torch-sparse torch-cluster torch-spline-conv torch-geometric -f https://data.pyg.org/whl/torch-1.11.0+cu115.html

// install jurpyter in pytorch enveriment
                   //check installed parkage
   conda install jupyter
Does PyTorch see any GPUs?		torch.cuda.is_available()
Are tensors stored on GPU by default?	torch.rand(10).device
Set default tensor type to CUDA:	torch.set_default_tensor_type(torch.cuda.FloatTensor)
Is this tensor a GPU tensor?		my_tensor.is_cuda
Is this model stored on the GPU?	all(p.is_cuda for p in my_model.parameters())

NVIDIA Driver Downloads:

CUDA Toolkit Downloads:

Install pytorch genmetric

🎭
2️⃣
https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html
https://www.nvidia.com/download/index.aspx
https://developer.nvidia.com/cuda-downloads
https://pytorch.org/get-started/pytorch-2.0/
https://pytorch-geometric.readthedocs.io/en/latest/install/installation.html