-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Recommended CNTK 2.0 Setup
You can install CNTK with in three different ways on Windows and Linux :
-
Binary install with prepackaged scripts (Recommended): This provides the fastest way to get started with CNTK and applicable to most practitioners. See the steps below.
-
Binary install with manual steps (Not Recommended): Only for those who need highly customized installations.
-
Build from sources (for developers): Those interested in contributing to CNTK.
[Note: The CNTK new Python and C++ APIs are an alpha release for early users to try and provide feedback on the usability and functional aspects of the API. Use of CNTK as an exe with BrainScript is not alpha, and in production]
Language Support:
CNTK can act as a library and provides Python and C++ APIs. Additionally, CNTK can be used as a standalone exe with BrainScript. When CNTK is used a library, these APIs enables programmatically defining CNTK models and drive their training/evaluation, using either built-in data readers or user supplied data in native Python numpy/C++ arrays.
-
Python:
- CNTK with Python APIs is supported natively on Windows with Python 3.4.4 and on Linux with Python 3.5. For both the platforms one can create a 3.4.4 python environment within any Anaconda (Python 2.7 or 3.x version).
-
Brainscript:
- CNTK also supports the BrainScript framework.
There are two steps in CNTK binary installation:
Step 1: Prerequisites installation
Step 2: Python (Anaconda environment) installation and CNTK binary package installation
Step 3: Clone from Github examples and tutorials
Please follow the links for:
Note: The script installs a CNTK Python 3.4 environment with Anaconda 4.1.1 located at $HOME/anaconda3/envs/cntk-py34
with all packages required for CNTK v2 Python and notebooks.
Please follow the steps below to install the binaries. The script will additionally clone the CNTK repository into C:\repos\cntk
.
Step 1: Prepare to run PowerShell scripts:
- Downloaded the scripts from here. Unzip/extract in a local folder say
C:\scripts
. One can create the director by executingmkdir C:\scripts
from a Windows command prompt. - Open PowerShell with administrator priviledges
- Click on Windows Start
- Search for Windows PowerShell (see below), Right click on the icon and select Run as administrator
- Type and run:
set-executionpolicy -executionpolicy unrestricted
. Upon being prompted, select A
- Close the PowerShell window
- Start a new Windows PowerShell application similar to previous step (not in Administrator mode )
Step 2: Run PowerShell scripts
- Run:
cd [Path to your unzipped PS scripts]
- Choose a wheel file appropriate for your machine:
- CPU: https://cntk.ai/pippackages/cpu/cntk-2.0a4-cp34-cp34m-win_amd64.whl
- GPU: https://cntk.ai/pippackages/gpu/cntk-2.0a4-cp34-cp34m-win_amd64.whl
- Run:
.\install.ps1 -Execute -cntkWhl [Location of the Whl file]
Step 3: Run Python setup
Open a windows command window or an anaconda command window
-
Run:
[Anaconda install folder root]\Scripts\activate cntk-py34
-
If you want to deploy a new CNTK wheel package at a later time simply re-run:
-
Run:
pip install –upgrade [Location of the wheel file]
Step 4: Verify setup
-
Python
- Run the examples from inside the
[CNTK clone root]/bindings/python
directory, to verify your installation. Runpython examples/NumpyInterop/feedforwardNet.py
. You should following output on the console:
- Run the examples from inside the
Minibatch: 0, Train Loss: 0.7915553283691407, Train Evaluation Criterion: 0.48
Minibatch: 20, Train Loss: 0.6266774368286133, Train Evaluation Criterion: 0.48
Minibatch: 40, Train Loss: 1.0378565979003906, Train Evaluation Criterion: 0.64
Minibatch: 60, Train Loss: 0.6558118438720704, Train Evaluation Criterion: 0.56
-
Brainscript (optional)
- Please run the following self contained example:
cd C:\repos\CNTK\Examples\Other\Simple2d
CNTK configFile=Config/Simple.cntk currentDirectory=Data
You should be able to see the results getting printed on the console.
Please follow the steps below to install the binaries. The script will additionally clone the CNTK repository into /home/[USERNAME]/repos/cntk
. Note: we have tested the script on Ubuntu 16.0.4. We first summarize what the script installs for you and sets the environment variables.
Step 1: Prepare to run scripts:
- Downloaded the scripts from here. Create a directory under
/home/[USERNAME]
and unzip the scripts in that folder.
Step 2: Run the bash scripts:
- Choose a wheel file appropriate for your machine:
- CPU: https://cntk.ai/pippackages/cpu/cntk-2.0a4-cp34-cp34m-linux_x86_64.whl
- GPU: https://cntk.ai/pippackages/gpu/cntk-2.0a4-cp34-cp34m-linux_x86_64.whl
Run: bash pycntkv2_linux_install.sh <url-of-wheel>
Step 3: Python updates
-
RUN:
source $HOME/anaconda3/bin/activate $HOME/anaconda3/envs/cntk-py34
to activate the python environment after the environment updates are completed. -
If you want to deploy a new CNTK wheel package at a later time simply re-run:
pip install –upgrade [Whl file location]
Step 4: Verify setup
-
Python
- Change to where the examples are located and run the python script:
cd c:\repos\CNTK\bindings\python\examples\NumpyInterop
python FeedForwardNet.py
A successful implementation should run the python example and you should be able to see output in the console.
Minibatch: 0, Train Loss: 0.7915553283691407, Train Evaluation Criterion: 0.48
Minibatch: 20, Train Loss: 0.6266774368286133, Train Evaluation Criterion: 0.48
Minibatch: 40, Train Loss: 1.0378565979003906, Train Evaluation Criterion: 0.64
Minibatch: 60, Train Loss: 0.6558118438720704, Train Evaluation Criterion: 0.56
-
Brainscript (optional)
- Please run the following self contained example:
cd C:\repos\CNTK\Examples\Other\Simple2d
CNTK configFile=Config/Simple.cntk currentDirectory=Data
You should be able to see the results getting printed on the console.