Simple experience using Amazon SageMaker to train a model (nanny level tutorial)

Simple experience using Amazon SageMaker to train a model

Introduction to Amazon SageMaker

Amazon Web Services (AWS) is the world's most comprehensive and broadly adopted cloud platform, offering more than 200 fully-featured services from data centers around the world. From infrastructure technologies like compute, storage, and databases, to emerging technologies like machine learning, artificial intelligence, data lakes and analytics, and the Internet of Things, Amazon SageMaker offers and includes far more services than any other cloud service provider many. This makes it faster, easier, and more cost-effective to migrate existing applications to the cloud and build almost anything you can imagine. This article will briefly describe how to easily experience Amazon SageMaker training a machine learning model.

recent activities

insert image description here

Preparation before experience

1. Try to make sure you have enough time. This experiment will take about 15 minutes.
2. Make sure your network is stable.
3. Calm down and don’t rush.
4. Create an account in advance (you must bind a bank card, you can choose to buy it) account)

Notice:

1. If you mistakenly apply for and create a notebook instance multiple times, there are restrictions on free users, and it will increase the burden on the computer.
2. If you don’t use the notebook instance, you must suspend it immediately. Some services are charged. The author’s cost exceeds 100 US dollars because of the random activation of the service! !

text

The first step (enter the home page)

1. Please log in to the Amazon cloud technology management console through the following link: https://ap-northeast-1.console.aws.amazon.com/console/home?region=ap-northeast-1#home
page: insert image description here
this experiment It will be performed in the US East (Northern Virginia) us-east-1 region
2. Click Service -> Amazon SageMaker
insert image description here
3. Find the notebook and select the notebook instance
insert image description here
4. Click Create Notebook Instance
insert image description here

The second step (create a notebook instance)

Notebook example manual: https://docs.aws.amazon.com/zh_cn/sagemaker/latest/dg/nbi.htm
Readers can create according to the manual, or continue to follow the author step by step
1. Create related settings
of Sagemaker The instance configuration is relatively high. If you want a free trial version, select t2.medium as the type (only this instance is free). It may be that the configuration is relatively high, so the free package time will be shorter than other types. EC2 is free The package is t2.micro, with 750 hours of experience time per month, which can be used all the time within a year. The rest of the version charges are not very expensive, mainly related to the time you use, so remember not to close or delete 2.
insert image description here
Create an IAM role
insert image description here
by default
insert image description here
3. Finally click Create 4.
insert image description here
Wait for five minutes (status bar Just convert from pending to inservice)

ps: AWS has many free services. Commonly used EC2, S3, RDS, etc. all support a limited free service for one year, and Sagemaker also has free experience services. Sagemaker is AWS's machine learning training platform, which hosts Jupyter Notebook and has built-in many commonly used machine learning algorithms.
insert image description here

The third step (training model)

1. Set the kernel (select conda_python3) and click to automatically open jupyter
insert image description here

2. Data download
Code source: Use Amazon SageMaker to build machine learning applications

!wget -N https://archive.ics.uci.edu/ml/machine-learning-databases/00222/bank-additional.zip
!unzip -o bank-additional.zip

insert image description here

insert image description here
Note: Every time you copy a code block, run it directly after pasting, and the next code box will automatically pop up for you to fill in. , if you don’t use proxy iip or foreign DNS , the operation may be a bit slow. Don’t worry
insert image description here
.

insert image description here
5. View training (click Training—>Training task)
Here you can view the training task, and you can further view the details (task start time, duration, hyperparameters, training data set, instance resource usage monitoring, model output location information).
insert image description here
6. Remember to delete training tasks, delete notebooks, etc. after stopping the instance!
7. Check whether the cost consumption is abnormal
insert image description here
8. This is the author's blood lesson! ! !
insert image description here

epilogue

The operation of this experiment is not very difficult. For big brothers or readers who are learning to train models, you can read the code in the manual in detail. For beginners, you are mainly familiar with the operation and usage skills of Amazon SageMaker. Amazon SageMaker has many other Functions, such as building fine-grained sentiment analysis applications, and quickly building AIGC applications based on the Stable Diffusion model.
Teaching link 1: Build a fine-grained sentiment analysis application based on Amazon SageMaker
Teaching link 2: Based on the Stable Diffusion model, quickly build your first AIGC application
Teaching link 3: Amazon Cloud Technology [Cloud Exploration Lab] Use Amazon SageMaker to build machines Learn applications, build fine-grained sentiment analysis applications, and quickly build your first AIGC application based on the Stable Diffusion model.
Refund Link Tutorial 1: https://www.vpsgo.com/aws-refund-tutorial.html
Refund Tutorial 2: https://www.xiaohongshu.com/explore/6318c30c0000000012008d77

Finally, I would like to thank Amazon for providing such an event, as well as the guidance and teaching of th0ma bloggers , so that we can experience the convenience brought by new products. I hope that every uu who loves to learn will be up day by day!

Guess you like

Origin blog.csdn.net/dixhusjsn/article/details/129843879