Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Sep 13, 2024. It is now read-only.

A few Windows specific scripts for PyTorch

NotificationsYou must be signed in to change notification settings

peterjc123/pytorch-scripts

Repository files navigation

This repowon't be updated anymore. Please refer tohttps://github.com/pytorch/builder/tree/main/windows for PyTorch building scripts andhttps://pytorch.org for PyTorch installation.

Original Content

It is a repo that contains scripts that makes using PyTorch on Windows easier.

Easy Installation

Update: Starting from 0.4.0, you can go to theofficial site for installation steps. The packages here will not be updated.If you just want to install PyTorch as soon as possible, you can try this one out.The current version of the conda package for PyTorch is 0.3.1.You'll need Anaconda first. And then type in the following commands.

# If your main Python version is not 3.5 or 3.6conda create-n test python=3.6 numpy pyyaml mkl# for CPU only packagesconda install-c peterjc123 pytorch-cpu# for Windows 10 and Windows Server 2016, CUDA 8conda install-c peterjc123 pytorch# for Windows 10 and Windows Server 2016, CUDA 9conda install-c peterjc123 pytorch cuda90# for Windows 7/8/8.1 and Windows Server 2008/2012, CUDA 8conda install-c peterjc123 pytorch_legacy

Plus: The support for old NV cards (Compute Capability <= 5.0) is over.There're mainly two ways to resolve this:

  1. You can install legacy packages. See description in this section below.
  2. Install CI packages. However, you have to handle the dependencies by yourself. SeeAbout CI packages for details.

If there's conflict against vc14, you may see workgroundhere.Sometimes the new packages may not work, when that happens, you may try the legacy packageshere. If you are from China, then the files are stored in Baidu Netdisk. You can access them through thislink.

About CI packages

There may be chances that the conda package is stale and you want to try out new features. For this purpose, the CI packages are generated.

SystemAll
Windows CPU (master)Build status
Windows GPU (master)Build status
Windows CPU (0.4.0)Build status
Windows GPU (0.4.0)Build status
Windows CPU (0.4.1)Build status
Windows GPU (0.4.1)Build status

About the nightly packages

An additional CI is setup to run every night so that you can also get the latest packages. The installation steps can be seenhere.

Configuration / Python version3.53.63.7
Windows x64 CPU (Conda)Build statusBuild statusBuild status
Windows x64 CPU (Wheels)Build statusBuild statusBuild status
Windows x64 CUDA 9.2 (Conda)Build statusBuild statusBuild status
Windows x64 CUDA 9.2 (Wheels)Build statusBuild statusBuild status
Windows x64 CUDA 10.0 (Conda)Build statusBuild statusBuild status
Windows x64 CUDA 10.0 (Wheels)Build statusBuild statusBuild status

And here are the libtorch packages. Only shared build is supported now. Please click the badge to download the latest package for a specific configuration.

Configuration / LibTorch versionShared library
Windows x64 CPU (Release)Build status
Windows x64 CPU (Debug)Build status
Windows x64 CUDA 9.2 (Release)Build status
Windows x64 CUDA 9.2 (Debug)Build status
Windows x64 CUDA 10.0 (Release)Build status
Windows x64 CUDA 10.0 (Debug)Build status

How to find the package and install?

You can first click the icon to get to the main page of the CI system for a certain package. You can see a few jobs under that page. There're several variables that is used to distinguish the packages.

  • PYTHON_VERSION : This one indicates the python version it use.

  • TORCH_CUDA_ARCH_LIST : It implies the architecture of the GPU, onlyPascal,Maxwell andKepler is supported.

After the choice of the jobs, you can see the generated package if you click onArtifact on the navigation bar in the middle of the page.

Installation is simple, but there're some requirements.

# For all versions# Windows x64# Python x64 3.5 / 3.6# MKL/Numpy/PyYAML# For GPU versions# CUDA 9 / 9.1# cuDNN 7# NVTX (Visual Studio Integration in CUDA. if it fails to be installed, you can extract#       the CUDA installer exe and found the NVTX installer under the CUDAVisualStudioIntegration)pip install numpy mkl intel-openmppip install pytorch-[version]-cp[pyversion]-cp[pyversion]m-win-amd64.whl# Add [PythonRoot]\Library\bin into environment variable `PATH` and restart command prompt before using.

Note: You may face with the following issue. First, check that all the dependencies are installed. Second, try if a fresh virtual environment helps. If it helps, it may be an issue of the python version. And you can install VC 2017 Redist. Finally, you may have to manually compile PyTorch from source.

C:\Anaconda2\lib\site-packages\torch\__init__.pyc in <module>()39     os.environ['PATH']= os.path.dirname(__file__)+'\\lib\\;'+ os.environ['PATH']40---> 41     from torch._C import *42__all__+= [namefor nameindir(_C)43if name[0]!='_'andImportError:DLL load failed: The specified procedure could not be found.

Compiling Examples

You can download it and put it in the PyTorch directory or use it in a standalone way.There're more details about MSVC 2017 setup in#23.

################################################################################# These are the flags that you can set before running the scripts.################################################################################# You can specify which version you want to build# If you omit it, it will build for the master branch on defaultset PYTORCH_BUILD_VERSION=0.4.1# If you want to build your own fork of PyTorchset PYTORCH_REPO=pytorch# If you want to build for a specific branch# Note: If you specify PYTORCH_BUILD_VERSION too, it won't be used.set PYTORCH_BRANCH=master# If you want to skip the confirmation of the flags configured by our scriptset NO_PROMPT=1# If you want to continue build without a verified VS version (Safe for CPU builds)set SKIP_VS_VER_CHECK=1# If you want to skip prompt for building for Python 2.7 (Not recommended)set SKIP_PY_VER_CHECK=1# If you want to build for LibTorchset BUILD_PYTHONLESS=1################################################################################# These are the available scripts that you can use.################################################################################# If you don't want to override the default settingsauto.bat# If you don't want to compile with CUDAcpu.bat# If you want to compile with CUDA 8cuda80.bat# If you want to compile with CUDA 9cuda90.bat# If you want to compile with CUDA 9.1cuda91.bat# If you want to compile with CUDA 9.2cuda92.bat# If you want to compile with CUDA 10.0cuda100.bat

Using Examples

# The main difference in Python between Windows and Unix systems is multiprocessing# So please refactor your code into the following structure if you use DataLoaderimporttorchdefmain():fori, (x,y)indataloader:# do something hereif__name__=='__main__':main()

About

A few Windows specific scripts for PyTorch

Resources

Stars

Watchers

Forks

Sponsor this project

    Packages

    No packages published

    Contributors4

    •  
    •  
    •  
    •  

    [8]ページ先頭

    ©2009-2025 Movatter.jp