Once you've installed Visual Studio Tools for AI, you can easily clone a repository of Python code and create a project from it.
-
To connect to GitHub repositories, run the Visual Studio installer, select Modify, and select the Individual components tab. Scroll down to the Code tools section, select GitHub extension for Visual Studio, and select Modify.
-
Launch Visual Studio.
-
Select View > Team Explorer... to open the Team Explorer window in which you can connect to GitHub or Visual Studio Team Services, or clone a repository.
-
In the URL field under Local Git Repositories, enter
https://github.com/Microsoft/samples-for-ai
, enter a folder for the cloned files, and select Clone.[!Tip] The folder you specify in Team Explorer is the specific folder to receive the cloned files. Unlike the
git clone
command, creating a clone in Team Explorer does not automatically create a subfolder with the name of the repository. -
When cloning is complete, double-click the repository folder at the bottom of Team Explorer to navigate to the repository dashboard. Under Solutions, select New....
-
In the New Project dialog that appears, select "From Existing Python Code", specify a name for the project, set Location to the same folder as the repository, and select OK. In the wizard that appears, select Finish.
-
Select View > Solution Explorer from the menu.
-
In Solution Explorer, expand the
TensorFlow Examples> MNIST
node, right-clickconvolutional.py
, and select Set as Startup File. This step tells Visual Studio which file it should use when running the project. -
Press Ctrl+F5 or select Debug > Start Without Debugging to run the program. If you see an `, re-check the working directory setting in the previous step.
-
When the program runs successfully, you'll see it start to download your training and test dataset, then train the model and output your error rate. You want error rate to decrease over time
If you are using Anaconda and get an error about missing numpy, you may need to change your python environment to use Anaconda