In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to set Jupyter Notebook". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to set Jupyter Notebook".
Set up an Amazon EC2 computer
I assume you have an AWS account and have access to the AWS console. If not, you may need to sign up for an Amazon AWS account.
AWS console: https://aws.amazon.com/console/
First, we need to go to the "Services" tab to access the EC2 dashboard.
On the EC2 dashboard, you can start by creating an instance.
Amazon has pre-installed deep learning software into the community AMI (Amazon Machine Images). To access these AMI, you need to check the community AMI and search for "Ubuntu Deep Learning" in the search tab. You can choose any other Linux style, but I find Ubuntu most useful for meeting my deep learning needs. In the current setup, I will use Deep Learning AMI (Ubuntu 18.04) version 27.0
After selecting AMI, you can select instance Type. Here, you can specify the amount of CPU, memory and GPU required in the system. Amazon offers a number of options based on individual needs. You can use the filter by filter to filter GPU instances.
In this tutorial, I used the p2.xlarge instance, which provides 2496 parallel processing kernels and GPU memory for 12GiB for NVIDIA K80 GPU.
You can change the storage connected to the machine in step 4. If you don't add storage in advance, that's fine, because you can do it later. I changed the storage space from 90 GB to 500 GB because most deep learning requirements require appropriate storage space.
That's all, you can start the instance after entering the final review instance settings screen. After clicking start, you will see this screen. Simply enter any key name in "Key pair name" and click "Download Key Pair". Your key will be downloaded to the computer according to the name you provided. For me, it is saved as "aws_key.pem". When you are finished, you can click "Launch Instances" to start the instance.
Please make sure that this key pair is secure, because you need to do this every time you want to log in to the instance.
Now, you can click "View Instances" on the next page to view your instance. This is what your example looks like:
To connect to your instance, simply open a terminal window on your local computer and browse to the folder where you save the key pair file and modify some permissions.
Chmod 400 aws_key.pem
After you have done this, you will be able to connect to your instance through SSH. The format of the SSH command is:
Ssh-I "aws_key.pem" ubuntu @
For me, the order is:
Ssh-I "aws_key.pem" ubuntu@ec2-54-202223-197.us-west-2.compute.amazonaws.com
Also, keep in mind that once the instance is shut down, the public DNS may change.
You have the machine ready and ready. This machine contains different environments that have all kinds of libraries you may need. This particular machine has MXNet,Tensorflow and Pytorch, as well as different versions of python. The best thing is that we have all these features pre-installed, so we can use them right out of the box.
Set up Jupyter Notebook
However, you still need to use something to make full use of the computer. One of them is Jupyter Notebook. To set up Jupyter Notebook on your computer, I recommend using TMUX and tunneling. Let's set up Jupyter Notebook step by step.
To run Jupyter Notebook using TMUX, we will first run Jupyter Notebook on the instance using TMUX. We mainly use it so that our laptops can still run even if the terminal connection is lost.
To do this, you will need to create a new TMUX session with the following command:
Tmux new-s StreamSession
When you are done, you will see a new screen with a green border at the bottom. You can use the jupyter notebook command to start Jupyter Notebook on this computer. You will see something similar to the following:
It would be beneficial to copy the login URL so that when we try to log in to jupyter notebook later, we will be able to get the token. For me, it is:
Http://localhost:8888/?token=5ccd01f60971d9fc97fd79f64a5bb4ce79f4d96823ab7872
The next step is to detach the TMUX session so that it continues to run in the background, even if you leave ssh shell. To do this, simply press Ctrl+B, then press D (do not press Ctrl when pressing D), and you will return to the splash screen showing the message that you have detached from the TMUX session.
If desired, you can reconnect to the session using the following methods:
Tmux attach-t StreamSession
SSH tunnel accesses notebook on the local browser
The second step is to enter the Amazon instance to get the Jupyter notebook on the local browser. As we can see, Jupyter notebook is actually running on the local host of the cloud instance. How do we access it? We use the SSH tunnel. Don't worry, it's easy. Simply use the following command on the local machine terminal window:
Ssh-I "aws_key.pem"-L: localhost:8888 ubuntu @
In this case, I used:
Ssh-I "aws_key.pem"-L 8001:localhost:8888 ubuntu@ec2-54-202223-197.us-west-2.compute.amazonaws.com
This means that if I open localhost:8001 in a local computer browser, I can use Jupyter Notebook. Of course I can. Now we only need to enter the token that has been saved in one of the previous steps to access notebook. To me, the token is 5ccd01f60971d9fc97fd79f64a5bb4ce79f4d96823ab7872.
Token: http://localhost:8888/?token=5ccd01f60971d9fc97fd79f64a5bb4ce79f4d96823ab7872&token=5ccd01f60971d9fc97fd79f64a5bb4ce79f4d96823ab7872
You just need to log in with your token.
Now, you can choose a new project by choosing any different environment you want. You can come from Tensorflow or Pythorch, or you can have both. Notebook won't let you down.
Troubleshooting
After restarting your computer, you may encounter some problems with your NVIDIA graphics card. Specifically, as far as I'm concerned, the nvidia-smi command stops working. If you encounter this problem, the solution is to download the graphics driver from the NVIDIA website.
NVIDIA website: https://www.nvidia.in/Download/index.aspx?lang=en-in
The above are the settings for the specific AMI I have chosen. After clicking search, you will see the next page:
Simply copy the download link by right-clicking and copying the link address. And run the following command on your computer. You may need to change the link address and file name.
# When nvidia-smi doesnt work:wget https://www.nvidia.in/content/DriverDownload-March3009/confirmation.php?url=/tesla/410.129/NVIDIA-Linux-x86_64-410.129-diagnostic.run&lang=in&type=Teslasudo sh NVIDIA-Linux-x86_64-410.129-diagnostic.run-- no-drm-- disable-nouveau-- dkms-- silent-- install-libglvndmodinfo nvidia | head-7sudo modprobe nvidia to stop the instance
okay. You have mastered and started the deep learning machine, and you are free to use it. Keep in mind that you should stop the instance whenever you stop working, so you don't have to pay Amazon when you are not working on the instance. You can do this on the instance page by right-clicking your instance. Please note that when you need to log in to the computer again, you may need to re-obtain the public DNS (IPv4) address from the instance page because it may have changed.
Thank you for your reading, the above is the content of "how to set Jupyter Notebook", after the study of this article, I believe you have a deeper understanding of the problem of how to set Jupyter Notebook, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.