Professional Documents
Culture Documents
AWS 기반 비용 효율적 고성능 기계학습 (ML) 플랫폼 뛰어들기
AWS 기반 비용 효율적 고성능 기계학습 (ML) 플랫폼 뛰어들기
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
본 세션에서 다루는 점
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
모든 개발자를 위한 인공 지능 도구 제공
VISION CHATBOTS SPEECH LANGUAGES VERTICAL
NEW NEW
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS Deep Learning AMIs
다양한 딥러닝 프레임워크를 미리 설치하고
최적 설정을 완료한 머신 이미지(Machine Image) 제공
https://aws.amazon.com/machine-learning/amis/
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
심지어 Deep Learning AMI는 진짜 빠릅니다!
차세대 C5 인스턴스에서 Intel AVX 및 MKL-dnn에 최적화된 TensorFlow 1.6 포함
ImageNet 데이터세트로 일반 바이너리 버전 대비 7.4배 빠른 모델 훈련 속도 제공
https://aws.amazon.com/ko/blogs/machine-learning/faster-training-with-optimized-
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. tensorflow-1-6-on-amazon-ec2-c5-and-p3-instances/
여기서 잠깐! C5 인스턴스 이란?
차세대 클라우드 가상화 환경인 Nitro를 기반한 컴퓨팅 전용 타입
C4 C5
36 vCPUs 72 vCPUs
2X vCPUs
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
EC2 P3 인스턴스 - 클라우드 기반 고성능 GPU 지원
1 PetaFLOPs의 컴퓨팅 성능 제공
300 GB/s GPU-to-GPU(NVLink) 네트워크 속도
P3 인스턴스 세부 정보
• NVIDIA Tesla V100 GPU 기반
• 40,960 CUDA cores 및 5120 Tensor Codes
• 128GB의 GPU 메모리
• 최대 8개의 GPU를 지원하는 다양한 인스턴스
타입 (p3.2xlarge, 8xlarge 및 16xlarge) 제공
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
EC2 P3 인스턴스로 GPU 클러스터를 만들어 본다면?
p3.2xlarge
= $5 per hour
(서울 리전 기준)
p3.2xlarge x 20
x 20
= $100 per hour
CPU 2,000 개 연산 능력
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
남는 여유 자원을 70% 할인된 가격에
모델 훈련 시에만 사용한다면
= $30 per hour
손으로 하실 필요 없어요~ 인프라를 코드로 짜면 됩니다!
API와 데브옵스를 통해 손쉽게 딥러닝 클러스터 구성 가능
다양한 CI/CD 기반 데브옵스 환경으로 빠른 학습 가능
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
여러분… 인생은 짧습니다! 시간을 아끼세요~
Inceptin V3
12.25 Alexnet
Speed up (x)
Ideal
1
1 4.75 8.5 12.25 16 # GPUs
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
기계학습은 일반 개발자에게 여전히 복잡하고 어렵다?!
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
그래서 준비했습니다… Amazon SageMaker
모델 생성 모델 훈련 모델 배포
https://aws.amazon.com/ko/sagemaker
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SageMaker를 통한 ML 서비스 아키텍처
Web assets on
Cloudfront
Amazon
SageMaker Training SageMaker Amazon S3 Cloudfront
Notebooks Algorithm Training
Deploy
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SageMaker 기반 ML 모델 생성 및 훈련
Amazon S3
Save Model
Fetch Training data ML Artifacts
Training
code
Save Inference
Image
Amazon ECR
K-Means Clustering
Principal Component Analysis
Neural Topic Modelling
Factorization Machines
Linear Learner - Regression
XGBoost Caffe2, CNTK, PyTorch, Torch
Bring Your Own Script
Latent Dirichlet Allocation (IM builds the Container)
Image Classification
Seq2Seq IM Estimators in Spark AWS MARKETPLACE
Linear Learner - Classification MACHINE LEARNING
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SageMaker - 자동 하이퍼 파라미터 최적화(HPO) 기능
https://medium.com/datadriveninvestor/auto-model-tuning-for-keras-on-amazon-sagemaker-plant-seedling-dataset-7b591334501e
https://aws.amazon.com/blogs/machine-learning/amazon-sagemaker-automatic-model-tuning-produces-better-models-faster/
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
ML 모델 훈련에 대한 비용과 시간 대비 효과
Distributed, with
$$$$ Strong Machines
$$$ Single
Machine
$$
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
ML 모델 훈련에 대한 비용과 시간 대비 효과
$$$$
$$$
On-premise
$$ EC2 + AMI
$ Amazon SageMaker
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Demo – SageMaker 기반 모델 훈련하기
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
사례. SageMaker 기반 기계 학습 구현 사례
기업 규모와 상관 없이
다양한 고객 활용 중!
Machine Learning 모델 학습은 쉽고,
빠르며, 비용 효과적으로 가능하지만… Training
추론 작업이 전체 기계 학습
비용의 대부분을 차지함 Inference
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
추론 비효율의 두 가지 주요 요인 :
복잡성 및 비용
다양한 추론 탄력적인 추론이
케이스가 존재 가능해야 함
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
추론 작업을 더 효율적으로 하는 방법
더 작은 P2 인스턴스를 더 작은 배치 크기로 실행하는 것이 더 효과적입니다.
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
NEW!
EC2
Instance
Amazon
Elastic Inference
EC2
Instance GPU
EC2
Instance
훨씬 저렴한 비용으로 신속한 추론을 위해 Amazon EC2 인스턴스에 GPU 가속 기능 추가 (최대 75 % 절감)
P3 P3
36 TOPS GPU
P3.8XL M5.large
P3 P3
Amazon
Elastic Inference Amazon
Elastic Inference
Before After
NEW!
AWS Inferentia
고성능 기계 학습 추론을 위한 AWS에서 설계 한 맞춤형 칩셋
EC2 인스턴스 지원
고성능 처리량
1 TFLOPS 32 TFLOPS
VPC 내부의 추론 간단한 음성 인식 및 추천 엔진 또는 사기 다양한 인스턴스
자연어 처리 모델 탐지 모델 타입 활용 가능
탄력성 보장
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
원하는 용량에 따라 가속기 타입 추가 가능
FP32 FP16 Accelerator
Accelerator Price ($/hr)
Throughput Throughput Memory
Type (US)
(TOPS) (TOPS) (GB)
eia1.medium 1 8 1 $0.13
eia1.large 2 16 2 $0.26
eia1.xlarge 4 32 4 $0.52
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
기존 GPU와 Elastic Inference와 비용 차이
120 70 140
100 60 120
50 100
80
40 80
60
30 60
40
20 40
20 10 20
0 0 0
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
EC2에 활용하는 방법
Region
VPC
Availability Zone
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
EC2 Auto Scaling groups에 적용하기
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SageMaker에 적용하기
SageMaker Notebooks
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Elastic Inference 설정 및 사용 방법
• 일반 EC2 인스턴스 선택 후, 미리 설정된 AMI에서 원하는 EI 가속기 선택
• EI 가속기가 접속할 수 있는 VPC 엔드포인트 권한 설정 필수
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Elastic Inference 설정 및 사용 방법
• MVCNN 모델 등 TF Estimators 포맷에 추가
• Dimensions: [batch_size , num_views , width , height , color_channels]
classifier = tf.estimator.Estimator(…)
input_tensor = tf.placeholder(dtype=tf.float32,
shape=[1, 80, 128, 128, 1],
name='images_tensor’)
input_map = {'images’ : input_tensor}
classifier.export_savedmodel(model_dir,
tf.estimator.export.build_raw_serving_input_receiver_fn(input_map))
AmazonEI_TensorFlow_Serving_v1.11_v1 --model_name=mvcnn \
--model_base_path=model_dir --port=9000
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
맺으면서
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
마지막으로… AWS Innovate 에서는
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
클라우드 및 인공 지능 관련 AWS 전문 교육 프로그램
aws-korea-marketing@amazon.com
twitter.com/AWSKorea
facebook.com/amazonwebservices.ko
youtube.com/user/AWSKorea
slideshare.net/awskorea
twitch.tv/aws
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.