SlideShare una empresa de Scribd logo
1 de 72
Descargar para leer sin conexión
2017 TensorFlow Dev Summit
Sequence Models and the RNN API
Produced By Tae Young Lee
이전의 기억들이 현재에 영향을 미친다
음성 인식
언어 모델
번역
영상에 주석 달기
chatbot
Chatbot code
RNN 동작 방식
https://github.com/macournoyer/neuralconvo
오랫동안 정보를 기억하는 것
LSTM 네트워크
장단기 기억 네트워크(Long Short Term Memory networks)는 보통 엘에스티엠으
로 불립니다. 엘에스티엠은 장기 의존성(Vanishing Gradient)을 학습을 수 있는 특
별한 종류의 순환 신경망입니다. 엘에스티엠은 Hochreiter와 Schmidhuber (1997)
에 의해 소개되었습니다.
그리고 이후 연구에서 많은 사람에 의해 다듬어지고 널리 알려졌습니다.1 엘에스티
엠은 매우 다양한 종류의 문제들에 대해 정말 잘 동작합니다. 그리고 현재 엘에스
티엠은 널리 사용되고 있습니다.
엘에스티엠은 장기 의존성 문제를 피하고자 설계되었습니다. 오랫동안 정보를 기
억하는 것이 사실상 엘에스티엠의 기본 동작입니다. 무언가 배우려고 애쓰기보다
는요.
모든 순환 신경망은 사슬 형태의 반복되는 신경망 모듈들을 가집니다. 표준 순환
신경망에서, 이 반복되는 모듈은 한 개의 tanh 층 같은 매우 간단한 구조를 가질 것
입니다.
https://docs.google.com/document/d/1M25vrmJHp21lK-
C8Xhg42zFzXke9_NrvhHBqH2qISfY/edit#
LSTM의 핵심은 셀 상태
다이어그램의 위쪽을 통과해 지나가는 수평선
셀 상태는 일종의 컨베이어 벨트
Sigmoid 층은 0에서 1사이 숫자를 출력
0은 “아무것도 통과 못함”
1은 “모두 통과함”
First 셀 상태에서 어떤 정보를 버릴지 결정하는 것
“잊기(forget) 게이트 층”이라 불리는 한
시그모이드 층에 의해 결정됩니다. 이 층
은 ht-1과 xt를 보고 셀 상태 Ct-1에서의
각 숫자를 위한 0과 1 사이 숫자를 출력
합니다. 1은 “이것을 완전히 유지함”을,
0은 “이것을 완전히 제거함”을 나타냄
Second 어떤 새로운 정보를 셀 상태에 저장할지 결정
입력
첫째, “입력(input) 게이트 층”이라 불리
는 한 시그모이드 층은 우리가 어떤 값들
을 갱신할지 결정
둘째, tanh 층은 셀 상태에 더해질 수 있
는 새로운 후보 값들의 벡터 Ct를 만듭니
다. 다음 단계에서, 우리는 셀 상태를 갱
신할 값을 만들기 위해 이 둘을 합함
Third 이제 이전 상태 Ct-1에서 Ct로 갱신함
이전 상태 Ct-1에 ft를 곱합니다. ft는 우
리가 전에 계산한 잊기 게이트 출력입니
다. ft는 우리가 잊기로 결정한 것들을 잊
게 만드는 역할
그런 다음 itCt를 더합니다. 이것이 각
상태 값을 우리가 얼만큼 갱신할지 결정
한 값으로 크기 변경한(scaled) 새 후보
값
Four 무엇을 출력할지 결정
출력은 셀 상태에 기반을 두지만 여과된
(filtered) 버전
우선, sigmoid 층을 동작시킴.
그 sigmoid 층은 셀 상태에서 어떤 부분
들을 출력할지 결정
그런 다음, 값이 -1과 1 사이 값을 갖도
록 셀 상태를 tanh에 넣음
결정한 부분만 출력하도록, tanh 출력을
다시 sigmoid 게이트 출력과 곱함
1
2
3
4
Topics
• Reading Sequence Data
• The RNN API
• Fully Dynamic Calculation
• Fused RNN Cells
• Dynamic Decoding
Reading and Batching
Sequence Data
1
Feeding Sequence Data
SequenceExample proto to store sequence
• Efficient storage of multiple sequence
• Per time step variable feature counts
• Efficient Parser Op
• tf.parse_single_sequence_example
• Coming soon : TensorFlow Serving “First Class” citizen
https://www.tensorflow.org/api_docs/python/tf/parse_single_sequence_example
Batching Sequence Data : Static Padding
Pad each input sequence yourself, use FIFOQueue :
tf.train.batch(…)
https://www.tensorflow.org/api_docs/python/tf/train/batch
Batching Sequence Data : Dynamic Padding
Use Padding FIFOQueue :
tf.train.batch(… dynamic_pad=True)
https://www.tensorflow.org/api_docs/python/tf/train/batch
Batching Sequence Data : Bucketing
Use N + 1 Queues with conditional enqueueing :
tf.contrib.training.bucket_by_sequence_length(…. dynamic_pad=True)
https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/api
_docs/python/functions_and_classes/shard8/tf.contrib.training.bucket_by_sequ
ence_length.md
Batching Sequence Data :
Truncated BPTT via State Saver
Use Barrier + Queues, you must call save_state each training step :
tf.contrib.training.batch_sequences_with_states(…)
https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/api
_docs/python/contrib.training.md
BPTT (Backpropagation Through Time)
BPTT는 순환신경망(RNN)에서 사용되는 (표준) 역전파 알고리즘입니다. RNN이
모든 시간 스텝에서 파라메터를 공유하기 때문에, 한 시점에서 오류가 역전파되
면 모든 이전 시점으로 퍼져 BPTT란 이름이 붙었습니다. 수백 개의 길이를 갖는
긴 입력 시퀀스가 들어오면, 계산 비용을 줄이기 위해 고정된 몇 스텝 이후에 오
류를 더이상 역전파하지 않고 멈추기도 합니다.
The RNN API
Evolution and Design Decisions
Simple RNN
RNNCell
• Provide knowledge about the specific RNN architecture
• Represent a time step as a layer (c.f. Keras layers)
Keras란?
Keras에 대한 설명은 http://keras.io/ 에서 찾아본다.
theano나 tensor flow를 이용한 예제를 보면 코드에는 확실히 보이는 인스턴스가
없는데 백그라운드에서 뭔가가 만들어지고 있다는 생각이 든다.
다른 언어를 쓰던 사람들은 어떨지 모르겠지만 C++을 주로 사용해오던 나로서는
이해가 안 되는 코드가 많다.
Keras는 그러한 '흑마술'을 없애고 눈에 확실히 보이는 코드로 theano나 tensor
flow를 wrapping 한 패키지
Fully Dynamic Calculation
Fast and Memory Efficient Custom Loops
Fully Dynamic Calculation
Goal : Handle sequence of unknown length
Tools :
• tf.while_loop
dynamic loops + gradients
• tf.TensorArray
dynamic Tensor slice access, gradients
https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/api_do
cs/python/functions_and_classes/shard4/tf.while_loop.md
https://www.tensorflow.org/api_docs/python/tf/TensorArray
RNN Encoder via Fully Dynamic RNN
2
Fused RNN Cells
Optimizations for Special Cases
Type of Fusion
• XLA Fused time steps
• Manually fused time steps
• Manually fused loops
Fusion tradeoffs :
• Flexibility for Speed
• “Works Everywhere” to “Fast on XOR(GPU, Android,…)”
XLA (Accelerated Linear Algebra) is a domain-specific compiler for linear algebra
that optimizes TensorFlow computations. The results are improvements in speed,
memory usage, and portability on server and mobile platforms. Initially, most
users will not see large benefits from XLA, but are welcome to experiment by
using XLA via just-in-time (JIT) compilaton or ahead-of-time (AOT) compilation.
Developers targeting new hardware accelerators are especially encouraged to try
out XLA
XLA (Accelerated Linear Algebra)는 TensorFlow 계산을 최적화하는 선형 대수학을
위한 도메인 별 컴파일러입니다. 그 결과 서버 및 모바일 플랫폼에서 속도, 메모리
사용 및 이식성이 개선되었습니다. 처음에는 대부분의 사용자가 XLA에서 큰 이익
을 볼 수는 없지만 JIT (Just-In-Time) 컴파일 또는 AOT (Ahead-Of-Time) 컴파일을
통해 XLA를 사용하여 실험 할 수 있습니다. 새로운 하드웨어 가속기를 목표로하는
개발자는 특히 XLA를 사용해 보는 것이 좋습니다.
https://www.tensorflow.org/versions/master/experimental/xla/
Dynamic Decoding
Forthcoming API
RNN Decoder via Fully Dynamic RNN
3
Dynamic Decoder
• New OO API
• Under active development
• Base decoder library for Open Source Neural Machine
Translation tutorial (coming soon)
• tf.contrib.seq2seq
https://gist.github.com/nikitakit/6ab61a73b86c50ad88d409bac3c3d09f
http://www.slideshare.net/KeonKim/attention-mechanisms-with-tensorflow
http://www.slideshare.net/KeonKim/attention-mechanisms-with-tensorflow
Beam Search의 일종 (Path-based algorithm)
Beam Search한 시점(t)마다 샘플링하는
대신에 여러 시점에서 샘플링을 시도함.
예) 확률이 높은 A, O을 선택하고, 이후의
단계에서 계속 예측을 시도함.
그리고 이중에서 전체확률이 가장 높은
sequence을 선택함.
이 방법은 단계가 진행할수록 계산양이 기하
급수적으로 증가하므로, 각각의 시점에서 가
장 가능성이 높은 몇몇 후보 서열만 남기고
계산을 진행함. => Beam Search
Helper functions for preparing translation data.
https://www.tensorflow.org/tutorials/seq2seq
Softmax
4
Softmax (소프트맥스) – cost function
소프트맥스는 클래스 분류 문제를 풀 때 (점수 벡터)를 (각 클래스별 확률)로 변
환하기 위해 흔히 사용하는 함수입니다. 각 점수에 지수(exp)를 취한 후, 정규화
상수로 나누어 총합이 1이 되도록 계산합니다. 여기서 만약 기계번역 문제처럼
클래스의 종류가 아주 많다면 정규화 상수를 계산하는 작업은 너무 비싼 연산이
됩니다. 효율적으로 계산하기 위한 대안으로 계층적 소프트맥스나 NCE 등 로스
기반 샘플링 기법 등이 있습니다.
noise-contrastive estimation (NCE) 손실 함수를 사용할 것이다. 이는 텐서 플
로우에 미리 구현된 tf.nn.nce_loss() 함수를 이용
2017 tensor flow dev summit

Más contenido relacionado

La actualidad más candente

Deep Learning Into Advance - 1. Image, ConvNet
Deep Learning Into Advance - 1. Image, ConvNetDeep Learning Into Advance - 1. Image, ConvNet
Deep Learning Into Advance - 1. Image, ConvNetHyojun Kim
 
Variational Autoencoder를 여러 가지 각도에서 이해하기 (Understanding Variational Autoencod...
Variational Autoencoder를 여러 가지 각도에서 이해하기 (Understanding Variational Autoencod...Variational Autoencoder를 여러 가지 각도에서 이해하기 (Understanding Variational Autoencod...
Variational Autoencoder를 여러 가지 각도에서 이해하기 (Understanding Variational Autoencod...Haezoom Inc.
 
Ai 그까이거
Ai 그까이거Ai 그까이거
Ai 그까이거도형 임
 
A Beginner's guide to understanding Autoencoder
A Beginner's guide to understanding AutoencoderA Beginner's guide to understanding Autoencoder
A Beginner's guide to understanding AutoencoderLee Seungeun
 
딥러닝 자연어처리 - RNN에서 BERT까지
딥러닝 자연어처리 - RNN에서 BERT까지딥러닝 자연어처리 - RNN에서 BERT까지
딥러닝 자연어처리 - RNN에서 BERT까지deepseaswjh
 
PYCON KR 2017 - 구름이 하늘의 일이라면 (윤상웅)
PYCON KR 2017 - 구름이 하늘의 일이라면 (윤상웅)PYCON KR 2017 - 구름이 하늘의 일이라면 (윤상웅)
PYCON KR 2017 - 구름이 하늘의 일이라면 (윤상웅)Haezoom Inc.
 
밑바닥부터 시작하는딥러닝 8장
밑바닥부터 시작하는딥러닝 8장밑바닥부터 시작하는딥러닝 8장
밑바닥부터 시작하는딥러닝 8장Sunggon Song
 
개발자를 위한 공감세미나 tensor-flow
개발자를 위한 공감세미나 tensor-flow개발자를 위한 공감세미나 tensor-flow
개발자를 위한 공감세미나 tensor-flow양 한빛
 
인공 신경망 구현에 관한 간단한 설명
인공 신경망 구현에 관한 간단한 설명인공 신경망 구현에 관한 간단한 설명
인공 신경망 구현에 관한 간단한 설명Woonghee Lee
 
Tensorflow for Deep Learning(SK Planet)
Tensorflow for Deep Learning(SK Planet)Tensorflow for Deep Learning(SK Planet)
Tensorflow for Deep Learning(SK Planet)Tae Young Lee
 
Sequence to Sequence Learning with Neural Networks
Sequence to Sequence Learning with Neural NetworksSequence to Sequence Learning with Neural Networks
Sequence to Sequence Learning with Neural NetworksHoon Heo
 
Character-Aware Neural Language Models
Character-Aware Neural Language ModelsCharacter-Aware Neural Language Models
Character-Aware Neural Language ModelsHoon Heo
 
Tensorflow service & Machine Learning
Tensorflow service & Machine LearningTensorflow service & Machine Learning
Tensorflow service & Machine LearningJEEHYUN PAIK
 
지적 대화를 위한 깊고 넓은 딥러닝 PyCon APAC 2016
지적 대화를 위한 깊고 넓은 딥러닝 PyCon APAC 2016지적 대화를 위한 깊고 넓은 딥러닝 PyCon APAC 2016
지적 대화를 위한 깊고 넓은 딥러닝 PyCon APAC 2016Taehoon Kim
 
Machine translation survey vol2
Machine translation survey   vol2Machine translation survey   vol2
Machine translation survey vol2gohyunwoong
 
Efficient Training of Bert by Progressively Stacking
Efficient Training of Bert by Progressively StackingEfficient Training of Bert by Progressively Stacking
Efficient Training of Bert by Progressively StackingHoon Heo
 
Io17ex automl & autodraw
Io17ex automl & autodrawIo17ex automl & autodraw
Io17ex automl & autodrawTae Young Lee
 
Attention is all you need
Attention is all you needAttention is all you need
Attention is all you needHoon Heo
 
[Tf2017] day1 jwkang_pub
[Tf2017] day1 jwkang_pub[Tf2017] day1 jwkang_pub
[Tf2017] day1 jwkang_pubJaewook. Kang
 

La actualidad más candente (20)

Deep Learning Into Advance - 1. Image, ConvNet
Deep Learning Into Advance - 1. Image, ConvNetDeep Learning Into Advance - 1. Image, ConvNet
Deep Learning Into Advance - 1. Image, ConvNet
 
Variational Autoencoder를 여러 가지 각도에서 이해하기 (Understanding Variational Autoencod...
Variational Autoencoder를 여러 가지 각도에서 이해하기 (Understanding Variational Autoencod...Variational Autoencoder를 여러 가지 각도에서 이해하기 (Understanding Variational Autoencod...
Variational Autoencoder를 여러 가지 각도에서 이해하기 (Understanding Variational Autoencod...
 
Ai 그까이거
Ai 그까이거Ai 그까이거
Ai 그까이거
 
A Beginner's guide to understanding Autoencoder
A Beginner's guide to understanding AutoencoderA Beginner's guide to understanding Autoencoder
A Beginner's guide to understanding Autoencoder
 
딥러닝 자연어처리 - RNN에서 BERT까지
딥러닝 자연어처리 - RNN에서 BERT까지딥러닝 자연어처리 - RNN에서 BERT까지
딥러닝 자연어처리 - RNN에서 BERT까지
 
PYCON KR 2017 - 구름이 하늘의 일이라면 (윤상웅)
PYCON KR 2017 - 구름이 하늘의 일이라면 (윤상웅)PYCON KR 2017 - 구름이 하늘의 일이라면 (윤상웅)
PYCON KR 2017 - 구름이 하늘의 일이라면 (윤상웅)
 
밑바닥부터 시작하는딥러닝 8장
밑바닥부터 시작하는딥러닝 8장밑바닥부터 시작하는딥러닝 8장
밑바닥부터 시작하는딥러닝 8장
 
개발자를 위한 공감세미나 tensor-flow
개발자를 위한 공감세미나 tensor-flow개발자를 위한 공감세미나 tensor-flow
개발자를 위한 공감세미나 tensor-flow
 
인공 신경망 구현에 관한 간단한 설명
인공 신경망 구현에 관한 간단한 설명인공 신경망 구현에 관한 간단한 설명
인공 신경망 구현에 관한 간단한 설명
 
Tensorflow for Deep Learning(SK Planet)
Tensorflow for Deep Learning(SK Planet)Tensorflow for Deep Learning(SK Planet)
Tensorflow for Deep Learning(SK Planet)
 
REALM
REALMREALM
REALM
 
Sequence to Sequence Learning with Neural Networks
Sequence to Sequence Learning with Neural NetworksSequence to Sequence Learning with Neural Networks
Sequence to Sequence Learning with Neural Networks
 
Character-Aware Neural Language Models
Character-Aware Neural Language ModelsCharacter-Aware Neural Language Models
Character-Aware Neural Language Models
 
Tensorflow service & Machine Learning
Tensorflow service & Machine LearningTensorflow service & Machine Learning
Tensorflow service & Machine Learning
 
지적 대화를 위한 깊고 넓은 딥러닝 PyCon APAC 2016
지적 대화를 위한 깊고 넓은 딥러닝 PyCon APAC 2016지적 대화를 위한 깊고 넓은 딥러닝 PyCon APAC 2016
지적 대화를 위한 깊고 넓은 딥러닝 PyCon APAC 2016
 
Machine translation survey vol2
Machine translation survey   vol2Machine translation survey   vol2
Machine translation survey vol2
 
Efficient Training of Bert by Progressively Stacking
Efficient Training of Bert by Progressively StackingEfficient Training of Bert by Progressively Stacking
Efficient Training of Bert by Progressively Stacking
 
Io17ex automl & autodraw
Io17ex automl & autodrawIo17ex automl & autodraw
Io17ex automl & autodraw
 
Attention is all you need
Attention is all you needAttention is all you need
Attention is all you need
 
[Tf2017] day1 jwkang_pub
[Tf2017] day1 jwkang_pub[Tf2017] day1 jwkang_pub
[Tf2017] day1 jwkang_pub
 

Similar a 2017 tensor flow dev summit

LSTM 네트워크 이해하기
LSTM 네트워크 이해하기LSTM 네트워크 이해하기
LSTM 네트워크 이해하기Mad Scientists
 
Auto Scalable 한 Deep Learning Production 을 위한 AI Serving Infra 구성 및 AI DevOps...
Auto Scalable 한 Deep Learning Production 을 위한 AI Serving Infra 구성 및 AI DevOps...Auto Scalable 한 Deep Learning Production 을 위한 AI Serving Infra 구성 및 AI DevOps...
Auto Scalable 한 Deep Learning Production 을 위한 AI Serving Infra 구성 및 AI DevOps...hoondong kim
 
Going asynchronous with netty - SOSCON 2015
Going asynchronous with netty - SOSCON 2015Going asynchronous with netty - SOSCON 2015
Going asynchronous with netty - SOSCON 2015Kris Jeong
 
C# / .NET Framework로 미래 밥그릇을 챙겨보자 (Basic)
C# / .NET Framework로 미래 밥그릇을 챙겨보자 (Basic)C# / .NET Framework로 미래 밥그릇을 챙겨보자 (Basic)
C# / .NET Framework로 미래 밥그릇을 챙겨보자 (Basic)Dong Chan Shin
 
Exploring Deep Learning Acceleration Technology Embedded in LLMs
Exploring Deep Learning Acceleration Technology Embedded in LLMsExploring Deep Learning Acceleration Technology Embedded in LLMs
Exploring Deep Learning Acceleration Technology Embedded in LLMsTae Young Lee
 
지금 핫한 Real-time In-memory Stream Processing 이야기
지금 핫한 Real-time In-memory Stream Processing 이야기지금 핫한 Real-time In-memory Stream Processing 이야기
지금 핫한 Real-time In-memory Stream Processing 이야기Ted Won
 
[2B2]기계 친화성을 중심으로 접근한 최적화 기법
[2B2]기계 친화성을 중심으로 접근한 최적화 기법[2B2]기계 친화성을 중심으로 접근한 최적화 기법
[2B2]기계 친화성을 중심으로 접근한 최적화 기법NAVER D2
 
동기화, 스케줄링
동기화, 스케줄링동기화, 스케줄링
동기화, 스케줄링xxbdxx
 
백억개의 로그를 모아 검색하고 분석하고 학습도 시켜보자 : 로기스
백억개의 로그를 모아 검색하고 분석하고 학습도 시켜보자 : 로기스백억개의 로그를 모아 검색하고 분석하고 학습도 시켜보자 : 로기스
백억개의 로그를 모아 검색하고 분석하고 학습도 시켜보자 : 로기스NAVER D2
 
A tour of C++ : the basics
A tour of C++ : the basicsA tour of C++ : the basics
A tour of C++ : the basicsJaewon Choi
 
Assembly 스터디 1
Assembly 스터디 1Assembly 스터디 1
Assembly 스터디 1Jinkyoung Kim
 
세션1. block chain as a platform
세션1. block chain as a platform세션1. block chain as a platform
세션1. block chain as a platformJay JH Park
 
딥러닝을 위한 Tensor flow(skt academy)
딥러닝을 위한 Tensor flow(skt academy)딥러닝을 위한 Tensor flow(skt academy)
딥러닝을 위한 Tensor flow(skt academy)Tae Young Lee
 
[한국어] Neural Architecture Search with Reinforcement Learning
[한국어] Neural Architecture Search with Reinforcement Learning[한국어] Neural Architecture Search with Reinforcement Learning
[한국어] Neural Architecture Search with Reinforcement LearningKiho Suh
 

Similar a 2017 tensor flow dev summit (20)

LSTM 네트워크 이해하기
LSTM 네트워크 이해하기LSTM 네트워크 이해하기
LSTM 네트워크 이해하기
 
Auto Scalable 한 Deep Learning Production 을 위한 AI Serving Infra 구성 및 AI DevOps...
Auto Scalable 한 Deep Learning Production 을 위한 AI Serving Infra 구성 및 AI DevOps...Auto Scalable 한 Deep Learning Production 을 위한 AI Serving Infra 구성 및 AI DevOps...
Auto Scalable 한 Deep Learning Production 을 위한 AI Serving Infra 구성 및 AI DevOps...
 
파이썬과 자연어 5 | 딥러닝
파이썬과 자연어 5 | 딥러닝파이썬과 자연어 5 | 딥러닝
파이썬과 자연어 5 | 딥러닝
 
Going asynchronous with netty - SOSCON 2015
Going asynchronous with netty - SOSCON 2015Going asynchronous with netty - SOSCON 2015
Going asynchronous with netty - SOSCON 2015
 
Lec 00, 01
Lec 00, 01Lec 00, 01
Lec 00, 01
 
C# / .NET Framework로 미래 밥그릇을 챙겨보자 (Basic)
C# / .NET Framework로 미래 밥그릇을 챙겨보자 (Basic)C# / .NET Framework로 미래 밥그릇을 챙겨보자 (Basic)
C# / .NET Framework로 미래 밥그릇을 챙겨보자 (Basic)
 
자연어5 | 1차강의
자연어5 | 1차강의자연어5 | 1차강의
자연어5 | 1차강의
 
Exploring Deep Learning Acceleration Technology Embedded in LLMs
Exploring Deep Learning Acceleration Technology Embedded in LLMsExploring Deep Learning Acceleration Technology Embedded in LLMs
Exploring Deep Learning Acceleration Technology Embedded in LLMs
 
llvm 소개
llvm 소개llvm 소개
llvm 소개
 
지금 핫한 Real-time In-memory Stream Processing 이야기
지금 핫한 Real-time In-memory Stream Processing 이야기지금 핫한 Real-time In-memory Stream Processing 이야기
지금 핫한 Real-time In-memory Stream Processing 이야기
 
[2B2]기계 친화성을 중심으로 접근한 최적화 기법
[2B2]기계 친화성을 중심으로 접근한 최적화 기법[2B2]기계 친화성을 중심으로 접근한 최적화 기법
[2B2]기계 친화성을 중심으로 접근한 최적화 기법
 
동기화, 스케줄링
동기화, 스케줄링동기화, 스케줄링
동기화, 스케줄링
 
백억개의 로그를 모아 검색하고 분석하고 학습도 시켜보자 : 로기스
백억개의 로그를 모아 검색하고 분석하고 학습도 시켜보자 : 로기스백억개의 로그를 모아 검색하고 분석하고 학습도 시켜보자 : 로기스
백억개의 로그를 모아 검색하고 분석하고 학습도 시켜보자 : 로기스
 
A tour of C++ : the basics
A tour of C++ : the basicsA tour of C++ : the basics
A tour of C++ : the basics
 
Nvidia architecture
Nvidia architectureNvidia architecture
Nvidia architecture
 
Assembly 스터디 1
Assembly 스터디 1Assembly 스터디 1
Assembly 스터디 1
 
세션1. block chain as a platform
세션1. block chain as a platform세션1. block chain as a platform
세션1. block chain as a platform
 
딥러닝을 위한 Tensor flow(skt academy)
딥러닝을 위한 Tensor flow(skt academy)딥러닝을 위한 Tensor flow(skt academy)
딥러닝을 위한 Tensor flow(skt academy)
 
[한국어] Neural Architecture Search with Reinforcement Learning
[한국어] Neural Architecture Search with Reinforcement Learning[한국어] Neural Architecture Search with Reinforcement Learning
[한국어] Neural Architecture Search with Reinforcement Learning
 
Mt
MtMt
Mt
 

Más de Tae Young Lee

Review of the Paper on Capabilities of Gemini Models in Medicine
Review of the Paper on Capabilities of Gemini Models in MedicineReview of the Paper on Capabilities of Gemini Models in Medicine
Review of the Paper on Capabilities of Gemini Models in MedicineTae Young Lee
 
A future that integrates LLMs and LAMs (Symposium)
A future that integrates LLMs and LAMs (Symposium)A future that integrates LLMs and LAMs (Symposium)
A future that integrates LLMs and LAMs (Symposium)Tae Young Lee
 
LLMs Service that provides what users want to know
LLMs Service that provides what users want to knowLLMs Service that provides what users want to know
LLMs Service that provides what users want to knowTae Young Lee
 
LLM 모델 기반 서비스 실전 가이드
LLM 모델 기반 서비스 실전 가이드LLM 모델 기반 서비스 실전 가이드
LLM 모델 기반 서비스 실전 가이드Tae Young Lee
 
Recommendation System History
Recommendation System HistoryRecommendation System History
Recommendation System HistoryTae Young Lee
 
검색엔진에 적용된 ChatGPT
검색엔진에 적용된 ChatGPT검색엔진에 적용된 ChatGPT
검색엔진에 적용된 ChatGPTTae Young Lee
 
검색엔진에 적용된 딥러닝 모델 방법론
검색엔진에 적용된 딥러닝 모델 방법론검색엔진에 적용된 딥러닝 모델 방법론
검색엔진에 적용된 딥러닝 모델 방법론Tae Young Lee
 
The Deep Learning Compiler
The Deep Learning CompilerThe Deep Learning Compiler
The Deep Learning CompilerTae Young Lee
 
History of Vision AI
History of Vision AIHistory of Vision AI
History of Vision AITae Young Lee
 
Enhanced ai platform
Enhanced ai platformEnhanced ai platform
Enhanced ai platformTae Young Lee
 
Real estate trust solution
Real estate trust solutionReal estate trust solution
Real estate trust solutionTae Young Lee
 
Transfer learning usage
Transfer learning usageTransfer learning usage
Transfer learning usageTae Young Lee
 
Create a solution including deep learning models
Create a solution including deep learning modelsCreate a solution including deep learning models
Create a solution including deep learning modelsTae Young Lee
 
Infra as a model service
Infra as a model serviceInfra as a model service
Infra as a model serviceTae Young Lee
 
Deep learning financial product recommendation model
Deep learning financial product recommendation modelDeep learning financial product recommendation model
Deep learning financial product recommendation modelTae Young Lee
 
Deep Learning Through Various Processes
Deep Learning Through Various ProcessesDeep Learning Through Various Processes
Deep Learning Through Various ProcessesTae Young Lee
 

Más de Tae Young Lee (20)

Review of the Paper on Capabilities of Gemini Models in Medicine
Review of the Paper on Capabilities of Gemini Models in MedicineReview of the Paper on Capabilities of Gemini Models in Medicine
Review of the Paper on Capabilities of Gemini Models in Medicine
 
A future that integrates LLMs and LAMs (Symposium)
A future that integrates LLMs and LAMs (Symposium)A future that integrates LLMs and LAMs (Symposium)
A future that integrates LLMs and LAMs (Symposium)
 
LLMs Service that provides what users want to know
LLMs Service that provides what users want to knowLLMs Service that provides what users want to know
LLMs Service that provides what users want to know
 
LLM 모델 기반 서비스 실전 가이드
LLM 모델 기반 서비스 실전 가이드LLM 모델 기반 서비스 실전 가이드
LLM 모델 기반 서비스 실전 가이드
 
Recommendation System History
Recommendation System HistoryRecommendation System History
Recommendation System History
 
검색엔진에 적용된 ChatGPT
검색엔진에 적용된 ChatGPT검색엔진에 적용된 ChatGPT
검색엔진에 적용된 ChatGPT
 
검색엔진에 적용된 딥러닝 모델 방법론
검색엔진에 적용된 딥러닝 모델 방법론검색엔진에 적용된 딥러닝 모델 방법론
검색엔진에 적용된 딥러닝 모델 방법론
 
PaLM Paper Review
PaLM Paper ReviewPaLM Paper Review
PaLM Paper Review
 
The Deep Learning Compiler
The Deep Learning CompilerThe Deep Learning Compiler
The Deep Learning Compiler
 
History of Vision AI
History of Vision AIHistory of Vision AI
History of Vision AI
 
Aws architecture
Aws architectureAws architecture
Aws architecture
 
Enhanced ai platform
Enhanced ai platformEnhanced ai platform
Enhanced ai platform
 
Ai based on gpu
Ai based on gpuAi based on gpu
Ai based on gpu
 
Real estate trust solution
Real estate trust solutionReal estate trust solution
Real estate trust solution
 
Transfer learning usage
Transfer learning usageTransfer learning usage
Transfer learning usage
 
Create a solution including deep learning models
Create a solution including deep learning modelsCreate a solution including deep learning models
Create a solution including deep learning models
 
Infra as a model service
Infra as a model serviceInfra as a model service
Infra as a model service
 
Bayesian learning
Bayesian learningBayesian learning
Bayesian learning
 
Deep learning financial product recommendation model
Deep learning financial product recommendation modelDeep learning financial product recommendation model
Deep learning financial product recommendation model
 
Deep Learning Through Various Processes
Deep Learning Through Various ProcessesDeep Learning Through Various Processes
Deep Learning Through Various Processes
 

2017 tensor flow dev summit

  • 1. 2017 TensorFlow Dev Summit Sequence Models and the RNN API Produced By Tae Young Lee
  • 2.
  • 3. 이전의 기억들이 현재에 영향을 미친다
  • 6.
  • 7.
  • 8.
  • 9.
  • 12. LSTM 네트워크 장단기 기억 네트워크(Long Short Term Memory networks)는 보통 엘에스티엠으 로 불립니다. 엘에스티엠은 장기 의존성(Vanishing Gradient)을 학습을 수 있는 특 별한 종류의 순환 신경망입니다. 엘에스티엠은 Hochreiter와 Schmidhuber (1997) 에 의해 소개되었습니다. 그리고 이후 연구에서 많은 사람에 의해 다듬어지고 널리 알려졌습니다.1 엘에스티 엠은 매우 다양한 종류의 문제들에 대해 정말 잘 동작합니다. 그리고 현재 엘에스 티엠은 널리 사용되고 있습니다. 엘에스티엠은 장기 의존성 문제를 피하고자 설계되었습니다. 오랫동안 정보를 기 억하는 것이 사실상 엘에스티엠의 기본 동작입니다. 무언가 배우려고 애쓰기보다 는요. 모든 순환 신경망은 사슬 형태의 반복되는 신경망 모듈들을 가집니다. 표준 순환 신경망에서, 이 반복되는 모듈은 한 개의 tanh 층 같은 매우 간단한 구조를 가질 것 입니다. https://docs.google.com/document/d/1M25vrmJHp21lK- C8Xhg42zFzXke9_NrvhHBqH2qISfY/edit#
  • 13.
  • 14.
  • 15. LSTM의 핵심은 셀 상태 다이어그램의 위쪽을 통과해 지나가는 수평선 셀 상태는 일종의 컨베이어 벨트
  • 16. Sigmoid 층은 0에서 1사이 숫자를 출력 0은 “아무것도 통과 못함” 1은 “모두 통과함”
  • 17. First 셀 상태에서 어떤 정보를 버릴지 결정하는 것 “잊기(forget) 게이트 층”이라 불리는 한 시그모이드 층에 의해 결정됩니다. 이 층 은 ht-1과 xt를 보고 셀 상태 Ct-1에서의 각 숫자를 위한 0과 1 사이 숫자를 출력 합니다. 1은 “이것을 완전히 유지함”을, 0은 “이것을 완전히 제거함”을 나타냄
  • 18. Second 어떤 새로운 정보를 셀 상태에 저장할지 결정 입력 첫째, “입력(input) 게이트 층”이라 불리 는 한 시그모이드 층은 우리가 어떤 값들 을 갱신할지 결정 둘째, tanh 층은 셀 상태에 더해질 수 있 는 새로운 후보 값들의 벡터 Ct를 만듭니 다. 다음 단계에서, 우리는 셀 상태를 갱 신할 값을 만들기 위해 이 둘을 합함
  • 19. Third 이제 이전 상태 Ct-1에서 Ct로 갱신함 이전 상태 Ct-1에 ft를 곱합니다. ft는 우 리가 전에 계산한 잊기 게이트 출력입니 다. ft는 우리가 잊기로 결정한 것들을 잊 게 만드는 역할 그런 다음 itCt를 더합니다. 이것이 각 상태 값을 우리가 얼만큼 갱신할지 결정 한 값으로 크기 변경한(scaled) 새 후보 값
  • 20. Four 무엇을 출력할지 결정 출력은 셀 상태에 기반을 두지만 여과된 (filtered) 버전 우선, sigmoid 층을 동작시킴. 그 sigmoid 층은 셀 상태에서 어떤 부분 들을 출력할지 결정 그런 다음, 값이 -1과 1 사이 값을 갖도 록 셀 상태를 tanh에 넣음 결정한 부분만 출력하도록, tanh 출력을 다시 sigmoid 게이트 출력과 곱함
  • 21.
  • 22. 1
  • 23. 2
  • 24. 3
  • 25. 4
  • 26. Topics • Reading Sequence Data • The RNN API • Fully Dynamic Calculation • Fused RNN Cells • Dynamic Decoding
  • 28. 1
  • 29. Feeding Sequence Data SequenceExample proto to store sequence • Efficient storage of multiple sequence • Per time step variable feature counts • Efficient Parser Op • tf.parse_single_sequence_example • Coming soon : TensorFlow Serving “First Class” citizen https://www.tensorflow.org/api_docs/python/tf/parse_single_sequence_example
  • 30.
  • 31. Batching Sequence Data : Static Padding Pad each input sequence yourself, use FIFOQueue : tf.train.batch(…) https://www.tensorflow.org/api_docs/python/tf/train/batch
  • 32. Batching Sequence Data : Dynamic Padding Use Padding FIFOQueue : tf.train.batch(… dynamic_pad=True) https://www.tensorflow.org/api_docs/python/tf/train/batch
  • 33. Batching Sequence Data : Bucketing Use N + 1 Queues with conditional enqueueing : tf.contrib.training.bucket_by_sequence_length(…. dynamic_pad=True) https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/api _docs/python/functions_and_classes/shard8/tf.contrib.training.bucket_by_sequ ence_length.md
  • 34. Batching Sequence Data : Truncated BPTT via State Saver Use Barrier + Queues, you must call save_state each training step : tf.contrib.training.batch_sequences_with_states(…) https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/api _docs/python/contrib.training.md
  • 35. BPTT (Backpropagation Through Time) BPTT는 순환신경망(RNN)에서 사용되는 (표준) 역전파 알고리즘입니다. RNN이 모든 시간 스텝에서 파라메터를 공유하기 때문에, 한 시점에서 오류가 역전파되 면 모든 이전 시점으로 퍼져 BPTT란 이름이 붙었습니다. 수백 개의 길이를 갖는 긴 입력 시퀀스가 들어오면, 계산 비용을 줄이기 위해 고정된 몇 스텝 이후에 오 류를 더이상 역전파하지 않고 멈추기도 합니다.
  • 36. The RNN API Evolution and Design Decisions
  • 37.
  • 38.
  • 40.
  • 41.
  • 42. RNNCell • Provide knowledge about the specific RNN architecture • Represent a time step as a layer (c.f. Keras layers) Keras란? Keras에 대한 설명은 http://keras.io/ 에서 찾아본다. theano나 tensor flow를 이용한 예제를 보면 코드에는 확실히 보이는 인스턴스가 없는데 백그라운드에서 뭔가가 만들어지고 있다는 생각이 든다. 다른 언어를 쓰던 사람들은 어떨지 모르겠지만 C++을 주로 사용해오던 나로서는 이해가 안 되는 코드가 많다. Keras는 그러한 '흑마술'을 없애고 눈에 확실히 보이는 코드로 theano나 tensor flow를 wrapping 한 패키지
  • 43.
  • 44.
  • 45. Fully Dynamic Calculation Fast and Memory Efficient Custom Loops
  • 46. Fully Dynamic Calculation Goal : Handle sequence of unknown length Tools : • tf.while_loop dynamic loops + gradients • tf.TensorArray dynamic Tensor slice access, gradients
  • 49.
  • 50. RNN Encoder via Fully Dynamic RNN 2
  • 51.
  • 52. Fused RNN Cells Optimizations for Special Cases
  • 53. Type of Fusion • XLA Fused time steps • Manually fused time steps • Manually fused loops Fusion tradeoffs : • Flexibility for Speed • “Works Everywhere” to “Fast on XOR(GPU, Android,…)”
  • 54. XLA (Accelerated Linear Algebra) is a domain-specific compiler for linear algebra that optimizes TensorFlow computations. The results are improvements in speed, memory usage, and portability on server and mobile platforms. Initially, most users will not see large benefits from XLA, but are welcome to experiment by using XLA via just-in-time (JIT) compilaton or ahead-of-time (AOT) compilation. Developers targeting new hardware accelerators are especially encouraged to try out XLA XLA (Accelerated Linear Algebra)는 TensorFlow 계산을 최적화하는 선형 대수학을 위한 도메인 별 컴파일러입니다. 그 결과 서버 및 모바일 플랫폼에서 속도, 메모리 사용 및 이식성이 개선되었습니다. 처음에는 대부분의 사용자가 XLA에서 큰 이익 을 볼 수는 없지만 JIT (Just-In-Time) 컴파일 또는 AOT (Ahead-Of-Time) 컴파일을 통해 XLA를 사용하여 실험 할 수 있습니다. 새로운 하드웨어 가속기를 목표로하는 개발자는 특히 XLA를 사용해 보는 것이 좋습니다. https://www.tensorflow.org/versions/master/experimental/xla/
  • 55.
  • 56.
  • 57.
  • 58.
  • 60. RNN Decoder via Fully Dynamic RNN 3
  • 61. Dynamic Decoder • New OO API • Under active development • Base decoder library for Open Source Neural Machine Translation tutorial (coming soon) • tf.contrib.seq2seq
  • 65. Beam Search의 일종 (Path-based algorithm) Beam Search한 시점(t)마다 샘플링하는 대신에 여러 시점에서 샘플링을 시도함. 예) 확률이 높은 A, O을 선택하고, 이후의 단계에서 계속 예측을 시도함. 그리고 이중에서 전체확률이 가장 높은 sequence을 선택함. 이 방법은 단계가 진행할수록 계산양이 기하 급수적으로 증가하므로, 각각의 시점에서 가 장 가능성이 높은 몇몇 후보 서열만 남기고 계산을 진행함. => Beam Search
  • 66. Helper functions for preparing translation data. https://www.tensorflow.org/tutorials/seq2seq
  • 67.
  • 68.
  • 69.
  • 71. Softmax (소프트맥스) – cost function 소프트맥스는 클래스 분류 문제를 풀 때 (점수 벡터)를 (각 클래스별 확률)로 변 환하기 위해 흔히 사용하는 함수입니다. 각 점수에 지수(exp)를 취한 후, 정규화 상수로 나누어 총합이 1이 되도록 계산합니다. 여기서 만약 기계번역 문제처럼 클래스의 종류가 아주 많다면 정규화 상수를 계산하는 작업은 너무 비싼 연산이 됩니다. 효율적으로 계산하기 위한 대안으로 계층적 소프트맥스나 NCE 등 로스 기반 샘플링 기법 등이 있습니다. noise-contrastive estimation (NCE) 손실 함수를 사용할 것이다. 이는 텐서 플 로우에 미리 구현된 tf.nn.nce_loss() 함수를 이용