This is the 21st day of my participation in the August Challenge. For details, check out the August Challenge ****

I haven’t been writing games recently, but I have been writing Python because I am interested in deep learning and want to learn about it. At the same time, I think AI is the future, so I went to learn it for a while.

1, the purpose is the combination of AI and game reinforcement learning, reinforcement learning is a branch of deep learning, a bit deep learning also wrote before, so the study route is from machine learning to study in depth and finally to the reinforcement learning, have to say that a route is a bit difficult for me, deep learning all kinds of formulas, various concepts, framework, It takes time to accumulate, so it can not be learned immediately. In the following period of time, it is still from shallow to deep, slowly approaching like reinforcement learning, hoping to produce something.

2, the psychological preparation Given my undergraduate basis, so my essay to the understanding of the formula may not much, just to learn from my understanding level, so if you see me write learning record, math is not good, don’t worry you don’t have to worry about formula can’t understand, because I also just understand fur, as long as understand the meaning behind the formula and the formula are doing, We can know what we are doing in the process of using it.

To be honest, the principle is very simple after you understand the formulas. Don’t be afraid.

3. Choice of IDE Today is the first AI article I wrote, so I have to do some work on the environment. All the articles on the market use Jupyter Notebook, but I asked the company’s AI chief, saying that it is ok for experiments and tutorials, but not suitable for real development, so I will not choose it. My editor of choice is PyCharm.

One of the most popular AI learning frameworks is TensorFlow and the other is PyTorch.

TensorFlow is from Google, PyTorch is from Facebook, and both have their own strengths.

TensorFlow is mostly used in production, while PyTorch is mostly used in scientific research, but our company seems to use PyTorch.

I choose PyTorch as the framework, for the reason that I can find senior managers to advise me. Another reason is that I installed PyTorch when I wrote reinforcement learning because of the limitation of the company’s network. I have some experience at that time, and you don’t need to worry if you don’t have experience.

Installation environment 1. Python installation

I chose Python 3.8 to install python, you can choose according to your environment, the installation tutorial is not verbose, all the way to next, lightning and sparks, no difficulty

Pycharm installation

The installation of PyCharm will not be covered. There are tutorials online, I believe there is no difficulty. If you really encounter difficulties, you can leave a message and communicate with me, or add my wechat, the menu of the public number can get my wechat

Pytorch installation

Because I write learning records, and also because of my laptop, GPU training is not supported. I may make up for it when I change to a desktop.

Pytorch website:

According to their own environment selection, generate installation command, most likely you and I are Windows, do not support GPU, so it is good to choose the same as ME

Execute from the console:

pip3 install torch torchvision torchaudio

It is executed in three ways:

First: If you are installing Python with environment variables, you can just start the start button and type CMD

Second: Enter the command in the pip3.exe directory

Also open CMD and type CD Python installation directory to go to the Python directory, for example:

cd C:\py38\Scripts

Or go directly to the pip3.exe directory, hold down the shfit key, and right click:

Then enter the install command

Third, enter terminal in Pycharm

Just wait for the installation to complete

4. Test environment

Test your environment by creating a PY file in PyCharm

#!/usr/bin/env python
# encoding: utf-8
"""#Author: Caraway @time: 2021/8/26 0026 9:59 PM"""
import  torch
if __name__ == '__main__':
   x = torch.rand(5.3)
Copy the code

Run without error, the output is as follows:

Copy the code

6, summary

Although the installation of the environment is very simple, but it is not easy for you to learn, after all, everything is difficult at the beginning, it is normal to encounter problems, the next chapter we write a primer, and introduce some concepts. Ready to learn together?