2022年9月26日 星期一

更新 PyTorch 版本至 v1.12.1

今天參加 PyTorch 的內訓課程時發現我筆電的 Torch 版本 v1.0.0 太舊了, 現在穩定版本已到 v1.12.1, 為了避免得到與課堂測試結果不同 (機率很低, 主要是怕缺了新功能), 所以就先進行昇版, 指令可在 PyTorch 官網產生 (視作業系統與 CPU/GPU 而異) :





我筆電是 Win10 沒有獨立顯卡所以要選 CPU, 指令如下 : 

pip3 install torch torchvision torchaudio

昇版的話後面加 -U :

C:\Users\User>pip install torch torchvision torchaudio -U      
Requirement already satisfied: torch in c:\python37\lib\site-packages (1.0.0)
Collecting torch
  Downloading torch-1.12.1-cp37-cp37m-win_amd64.whl (161.9 MB)
     ---------------------------------------- 161.9/161.9 MB 1.0 MB/s eta 0:00:00
Requirement already satisfied: torchvision in c:\python37\lib\site-packages (0.2.1)
Collecting torchvision
  Downloading torchvision-0.13.1-cp37-cp37m-win_amd64.whl (1.1 MB)
     ---------------------------------------- 1.1/1.1 MB 1.3 MB/s eta 0:00:00
Collecting torchaudio
  Downloading torchaudio-0.12.1-cp37-cp37m-win_amd64.whl (969 kB)
     ---------------------------------------- 969.1/969.1 kB 1.4 MB/s eta 0:00:00
Requirement already satisfied: typing-extensions in c:\python37\lib\site-packages (from torch) (4.3.0)
Requirement already satisfied: pillow!=8.3.*,>=5.3.0 in c:\python37\lib\site-packages (from torchvision) (8.1.0)
Requirement already satisfied: requests in c:\python37\lib\site-packages (from torchvision) (2.28.1)
Requirement already satisfied: numpy in c:\python37\lib\site-packages (from torchvision) (1.19.4)
Requirement already satisfied: certifi>=2017.4.17 in c:\python37\lib\site-packages (from requests->torchvision) (2018.11.29)
Requirement already satisfied: idna<4,>=2.5 in c:\python37\lib\site-packages (from requests->torchvision) (2.8)
Requirement already satisfied: charset-normalizer<3,>=2 in c:\python37\lib\site-packages (from requests->torchvision) (2.1.1)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\python37\lib\site-packages (from requests->torchvision) (1.24.1)
Installing collected packages: torch, torchvision, torchaudio
  Attempting uninstall: torch
    Found existing installation: torch 1.0.0
    Uninstalling torch-1.0.0:
      Successfully uninstalled torch-1.0.0
  Attempting uninstall: torchvision
    Found existing installation: torchvision 0.2.1
    Uninstalling torchvision-0.2.1:
      Successfully uninstalled torchvision-0.2.1
Successfully installed torch-1.12.1 torchaudio-0.12.1 torchvision-0.13.1

雖然 torch 本身蠻大的 (161MB), 但其實安裝也很快. 更新完後來檢驗看看版本 :

C:\Users\User>python    
Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 23:09:28) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch as t    
>>> t.__version__    
'1.12.1+cpu'   

沒錯喔, 已經升到 1.12.1 版啦. 

沒有留言 :