SlideShare ist ein Scribd-Unternehmen logo
1 von 35
자연어처리 초보자의
BERT 도전기
김윤기
Common Computer
간단 소개
• 시각장애인을 위한 보행로 안내 AI
• 시각장애인을 위한 보행로 안내 AI
AI Hub 인도보행 공개 데이터 구축
간단 소개
http://www.aihub.or.kr/aidata/136
https://github.com/YoongiKim/Walk-Assistant
• 음성, 텍스트  수화 번역 AI
간단 소개
(Example)
• 음성, 텍스트  수화 번역 AI
https://link.ainize.ai/unet-lstm-based-speech-to-sign
간단 소개
• 지금은 대학생 (1학년)
Common Computer에서 방학때부터 2달 째 인턴 중
그 동안 관심있었던 자연어처리 분야 도전!
간단 소개
• Bidirectional Encoder Representations from Transformers
https://paul-hyun.github.io/bert-01/
BERT?
http://jalammar.github.io/illustrated-bert/
• Word2Vec -> 맥락과 관계 없이 단어를 벡터화
예시) “Apple” -> [0.8, 0.1, 0.5, 0.3, …] -> RNN
• BERT(Transformer) -> 문장의 맥락을 고려해서 문장을 통째로 벡터화
예시) “I ate an apple” -> [[0.3, 0.6, 0.1, …], [0.2, 0.5, 0.3, …], [0.3, 0.2, 0.9, …], [0.2, 0.5, 0.1, …]]
https://medium.com/analytics-vidhya/implementing-word2vec-in-tensorflow-44f93cf2665f
BERT 와 기존 방식과의 차이점
AI의 Next step → NLP
• Computer Vision [정복]
• Speech Recognition [정복]
↓ (Next step)
• Natural Language Processing
• Logical Thinking
Google Trends
대표적인 NLP Tasks
• Language Modeling
• Text Classification
• Question Answering
• Text Generation
• Summarization
• Translation
--- 언어에 대한 이해, 검색어 추천
--- 감정 분석, 스팸 분류
--- 기계 독해, 지식 문답
--- 모든 종류의 글 작성
--- 개요 생성, 글 요약
--- 구글번역기, 파파고
Question Answering Task에 관심
• BERT로 할 만한 게 뭐가 있을까?
• SQuAD2.0 이라는 질의응답 Task가 있음
https://colab.research.google.com/drive/1uSlWtJdZmLrI3FCNIlUHFxwAJiSu2J0-
KorQuAD를 해보자
"한국어를 해보고 싶은데 괜찮은 것이 없을까?"
( SQuAD는 영어 버전, KorQuAD는 한국어 버전 )
https://korquad.github.io/
KorQuAD! 근데 엄청 어렵다!
대기업들로 꽉 찬 리더보드…
처음 배우는 내가 과연 할 수 있을까? 그것도 혼자서?
일단 해보자!
BERT모델을 이용한 KorQuAD 2.1 도전기
• What is KorQuAD 2.1?
• 한글 Wiki 백과에서 질문이 주어졌을 때
답변에 해당하는 부분(start, end)을 찾는 Task.
KorQuAD가 중요한 이유?
• Pre-Trained + Fine-Tuning로 이루어지는데
• KorQuAD는 한국어로 잘 학습된 Pre-Trained 모델과
QuestionAnswering에 적합하게 Fine-Tuning이 필요.
• KorQuAD에서 잘 작동하면 한국어에 대한 전반적인 Task 정확도가 높다는 것!
Why is Python So Good for Machine Learning?
• 쓸 수 있는 라이브러리가 많다!
• 생산성이 높고 이해하기 쉽다!
• 다른 언어에 비해 코드가 훨씬 짧다!
• 파이썬 500줄이면 C++/Java는 1000줄 이상
…
https://medium.com/@UdacityINDIA/why-use-python-for-machine-learning-e4b0b4457a77
도전 타임라인
• 2020년 6월 24일: Common Computer 인턴 시작
- NLP 분야, BERT 모델 공부, Bert-as-service Ainize
• 2020년 7월 9일: KorQuad 프로젝트 시작
- Redis Database로 Pipeline 개발 + Multiprocessing 적용
→ 10시간 걸리던 전처리를 3분으로 줄임!
• 2020년 8월 7일: EM=8.959 / F1=18.88
- 한국어 Evaluation 유니코드 문제점 해결
• 2020년 8월 19일: EM=48.597 / F1=66.073 [14위 Baseline 넘김]
• 2020년 8월 21일: EM=65.76 / F1=75.18 [11위]
이제부터 본격적인 시작! 아직 하는 중!!
1. NLP 분야, BERT 모델 공부
• BERT 공부에 도움되었던 자료들
https://bit.ly/3b2ZYli
2. Huggingface Transformers
(실행 결과)
• PyTorch + Tensorflow 2.0 환경으로
아주 간단하게 BERT 모델을 돌릴 수 있는 library
KorQuAD 2.0 데이터셋 (7GB .json.zip)
3. SQuAD에 KorQuAD v2 데이터를 넣어보자!
• Raw Text → Tokenized → Labeled Values → Model → (start, end) → Result
• 영어의 경우
• Raw Text 1byte → Tokenized String 1byte
• 한글의 경우
• Raw Text 2~4bytes → Tokenized String x3 bytes
-> 한 문장을 처리하는데도 메모리 사용량이 급증
4. Redis Database로 Pipeline 개발
• 기본 SQuAD 데이터셋은 40MB (v2)
KorQuAD 데이터셋은 7GB (v2.1)
• KorQuAD 데이터셋은 JSON으로, 한 파일 안에 1,000개의 질문과 답변
→ 이걸 한번에 로딩해서 각 단계에서 필요한 정보를 가져오는 것은 매우 비효율적
• JSON Loads + Tokenize == 200GB+ 메모리 필요!
• JSON → Redis
Tokenized Result → Redis
Label & Dictionary → Redis
== 70GB Memory 달성!
+ CPU 256개 멀티 프로세싱
전처리 과정에 걸리는 시간을 10시간→ 3분으로 단축
+ Profiler로 최적화
대용량의 JSON/CSV를 Memory-efficient하게 읽어들이기 위해
Pandas 라이브러리를 썼으나, 비효율적임을 확인할 수 있었음
https://www.quora.com/What-are-the-fastest-ways-to-read-text-lines-in-large-files-by-Python
https://nelsonslog.wordpress.com/2015/02/26/python-file-reading-benchmarks/
Before → After
+ Profiler로 최적화
5. 한글 유니코드 차이로 인한 오작동 해결
• NFD(조합형), NFC(완성형) 차이로 인한 Evaluation 문제
파 이 콘 2 0 2 0 [PAD] [PAD] [PAD]
↕ ↕ ↕ ↕ ↕ ↕ ↕ ↕ ↕ ↕
ㅍ ㅏ ㅇ ㅣ ㅋ ㅗ ㄴ 2 0 2
정답
모델 출력 결과
아직 NLP 시작한지 2달 밖에 안 지났지만…
• 처음에 불가능해 보였던 목표에 어느정도 근접
• Research 보다는 Engineering 과정이 훨씬 많았음.
• 사실상 2달 동안 전처리만 함…
• Vision과는 비교도 안되게 복잡한 전처리…
• 그래도 baseline은 넘겼음. 이제부터 본격적인 연구 가능할 듯!
최근에 핫한 GPT-3
https://blog.pingpong.us/gpt3-review/
GPT-3 특징
• 모델의 크기를 키우면 General한 Task에 쓸 수 있다!
https://mc.ai/gpt-3-the-new-mighty-language-model-from-openai-2/ https://www.zdnet.com/article/openais-gigantic-gpt-3-hints-at-the-limits-of-language-models-for-ai/
한국어 GPT-3를 만들고 싶다!
영어만 학습이 가능해서, 한국어 → 영어 → 한국어로 번역해야 함.
앞으로 계획
• KorQuAD 2.0 의미있는(1th?) 점수 찍기
• 한글 GPT 모델 만들어보기!
• 잘 만들어서 Ainize API로 공개하기!
해보고 싶은 프로젝트?
• 학교 과제 대신해주는 AI (개요 -> 에세이)
• 문서 작성 자동화
개인이 돌리기엔 모델이 너무 크다...
개인 GPU에서는 학습 조차 어려움…
GPU 메모리 12기가는 되어야...
(GTX-1080TI가 8기가인데?)
https://www.neowin.net/news/nvidia-registers-the-worlds-quickest-bert-training-time-and-largest-transformer-based-model/
로 Bert API 돌려보기
github.com/hanxiao/bert-as-service -> link.ainize.ai/bert-as-a-service
github.com/konlpy/konlpy -> link.ainize.ai/konlpy
로 KoNLPy API 돌려보기
OpenSource-as-a-Service Platform
무거운 모델, GPU가 필요한 코드까지 Ainize로 올려보세요!
https://ainize.ai/
Common Computer에서
동료들과 함께 성장해 나갈 개발자를 찾습니다.
채용 문의 phillip@comcom.ai
https://comcom.ai > Careers

Weitere ähnliche Inhalte

Was ist angesagt?

GPU Computing for Data Science
GPU Computing for Data Science GPU Computing for Data Science
GPU Computing for Data Science Domino Data Lab
 
SPEAK with CHATGPT 24h in US Language
SPEAK with CHATGPT 24h in US LanguageSPEAK with CHATGPT 24h in US Language
SPEAK with CHATGPT 24h in US LanguageErol GIRAUDY
 
AI and the Future.pptx
AI and the Future.pptxAI and the Future.pptx
AI and the Future.pptxJeffOHara9
 
How to Teach and Learn with ChatGPT - BETT 2023
How to Teach and Learn with ChatGPT - BETT 2023How to Teach and Learn with ChatGPT - BETT 2023
How to Teach and Learn with ChatGPT - BETT 2023Dominik Lukes
 
Using AI chatbots for deep learning and teaching with specific examples to en...
Using AI chatbots for deep learning and teaching with specific examples to en...Using AI chatbots for deep learning and teaching with specific examples to en...
Using AI chatbots for deep learning and teaching with specific examples to en...Nigel Daly
 
Generative AI and law.pptx
Generative AI and law.pptxGenerative AI and law.pptx
Generative AI and law.pptxChris Marsden
 
On the Application of AI for Failure Management: Problems, Solutions and Algo...
On the Application of AI for Failure Management: Problems, Solutions and Algo...On the Application of AI for Failure Management: Problems, Solutions and Algo...
On the Application of AI for Failure Management: Problems, Solutions and Algo...Jorge Cardoso
 
Arduino and IoT (Internet of Things)
Arduino and IoT (Internet of Things)Arduino and IoT (Internet of Things)
Arduino and IoT (Internet of Things)Shahed Mehbub
 
Presentation-Open AI Chat GPT-4 3.pptx
Presentation-Open AI Chat GPT-4 3.pptxPresentation-Open AI Chat GPT-4 3.pptx
Presentation-Open AI Chat GPT-4 3.pptxNitinKhandelwal71
 
What Is Artificial Intelligence in Product Management by Apple PM
What Is Artificial Intelligence in Product Management by Apple PMWhat Is Artificial Intelligence in Product Management by Apple PM
What Is Artificial Intelligence in Product Management by Apple PMProduct School
 
AI Product Manager
AI Product Manager AI Product Manager
AI Product Manager Datentreiber
 
ChatGPT-Template-slidesppt.net_.pptx
ChatGPT-Template-slidesppt.net_.pptxChatGPT-Template-slidesppt.net_.pptx
ChatGPT-Template-slidesppt.net_.pptxRameshBabu161437
 

Was ist angesagt? (20)

GPU Computing for Data Science
GPU Computing for Data Science GPU Computing for Data Science
GPU Computing for Data Science
 
ChatGPT Use- Cases
ChatGPT Use- Cases ChatGPT Use- Cases
ChatGPT Use- Cases
 
SPEAK with CHATGPT 24h in US Language
SPEAK with CHATGPT 24h in US LanguageSPEAK with CHATGPT 24h in US Language
SPEAK with CHATGPT 24h in US Language
 
AI and the Future.pptx
AI and the Future.pptxAI and the Future.pptx
AI and the Future.pptx
 
How to Teach and Learn with ChatGPT - BETT 2023
How to Teach and Learn with ChatGPT - BETT 2023How to Teach and Learn with ChatGPT - BETT 2023
How to Teach and Learn with ChatGPT - BETT 2023
 
Using AI chatbots for deep learning and teaching with specific examples to en...
Using AI chatbots for deep learning and teaching with specific examples to en...Using AI chatbots for deep learning and teaching with specific examples to en...
Using AI chatbots for deep learning and teaching with specific examples to en...
 
Generative AI and law.pptx
Generative AI and law.pptxGenerative AI and law.pptx
Generative AI and law.pptx
 
OpenAI Chatgpt.pptx
OpenAI Chatgpt.pptxOpenAI Chatgpt.pptx
OpenAI Chatgpt.pptx
 
On the Application of AI for Failure Management: Problems, Solutions and Algo...
On the Application of AI for Failure Management: Problems, Solutions and Algo...On the Application of AI for Failure Management: Problems, Solutions and Algo...
On the Application of AI for Failure Management: Problems, Solutions and Algo...
 
ChatGPT ChatBot
ChatGPT ChatBotChatGPT ChatBot
ChatGPT ChatBot
 
Arduino and IoT (Internet of Things)
Arduino and IoT (Internet of Things)Arduino and IoT (Internet of Things)
Arduino and IoT (Internet of Things)
 
OpenAI.pptx
OpenAI.pptxOpenAI.pptx
OpenAI.pptx
 
200109-Open AI Chat GPT.pptx
200109-Open AI Chat GPT.pptx200109-Open AI Chat GPT.pptx
200109-Open AI Chat GPT.pptx
 
ENGLISH.chatgpt.pptx
ENGLISH.chatgpt.pptxENGLISH.chatgpt.pptx
ENGLISH.chatgpt.pptx
 
ChatGPT.pptx
ChatGPT.pptxChatGPT.pptx
ChatGPT.pptx
 
Presentation-Open AI Chat GPT-4 3.pptx
Presentation-Open AI Chat GPT-4 3.pptxPresentation-Open AI Chat GPT-4 3.pptx
Presentation-Open AI Chat GPT-4 3.pptx
 
What Is Artificial Intelligence in Product Management by Apple PM
What Is Artificial Intelligence in Product Management by Apple PMWhat Is Artificial Intelligence in Product Management by Apple PM
What Is Artificial Intelligence in Product Management by Apple PM
 
AI Product Manager
AI Product Manager AI Product Manager
AI Product Manager
 
ChatGPT + RPA= A New Tech Revolution
ChatGPT + RPA=  A New Tech RevolutionChatGPT + RPA=  A New Tech Revolution
ChatGPT + RPA= A New Tech Revolution
 
ChatGPT-Template-slidesppt.net_.pptx
ChatGPT-Template-slidesppt.net_.pptxChatGPT-Template-slidesppt.net_.pptx
ChatGPT-Template-slidesppt.net_.pptx
 

Ähnlich wie PyCon2020 NLP beginner's BERT challenge

삶이편해지는_백엔드_개발자_지식.pdf
삶이편해지는_백엔드_개발자_지식.pdf삶이편해지는_백엔드_개발자_지식.pdf
삶이편해지는_백엔드_개발자_지식.pdfSeung kyoo Park
 
초고속 웹사이트 개발을 위한 Codeigniter PHP Framework
초고속 웹사이트 개발을 위한 Codeigniter PHP Framework초고속 웹사이트 개발을 위한 Codeigniter PHP Framework
초고속 웹사이트 개발을 위한 Codeigniter PHP FrameworkInseok Lee
 
131 deview 2013 yobi-채수원
131 deview 2013 yobi-채수원131 deview 2013 yobi-채수원
131 deview 2013 yobi-채수원NAVER D2
 
AngularJS In Production
AngularJS In ProductionAngularJS In Production
AngularJS In ProductionMooYeol Lee
 
Golang+on+analytics+and+blockchain
Golang+on+analytics+and+blockchainGolang+on+analytics+and+blockchain
Golang+on+analytics+and+blockchainNAVER Engineering
 
백엔드 개발자로 1인분하기
백엔드 개발자로 1인분하기백엔드 개발자로 1인분하기
백엔드 개발자로 1인분하기민건 주
 
레가시 프로젝트의 빌드 자동화
레가시 프로젝트의 빌드 자동화레가시 프로젝트의 빌드 자동화
레가시 프로젝트의 빌드 자동화Jaehoon Choi
 
DevOps는 원격근무를 추구하면 안되는 걸까?
DevOps는 원격근무를 추구하면 안되는 걸까?DevOps는 원격근무를 추구하면 안되는 걸까?
DevOps는 원격근무를 추구하면 안되는 걸까?Jesang Yoon
 
회사에서 새로운 기술_적용하기
회사에서 새로운 기술_적용하기회사에서 새로운 기술_적용하기
회사에서 새로운 기술_적용하기Dexter Jung
 
200819 NAVER TECH CONCERT 07_신입 iOS 개발자 개발업무 적응기
200819 NAVER TECH CONCERT 07_신입 iOS 개발자 개발업무 적응기200819 NAVER TECH CONCERT 07_신입 iOS 개발자 개발업무 적응기
200819 NAVER TECH CONCERT 07_신입 iOS 개발자 개발업무 적응기NAVER Engineering
 
PHP로 웹개발을 해보자
PHP로 웹개발을 해보자PHP로 웹개발을 해보자
PHP로 웹개발을 해보자Young Min Shin
 
C++ 코드 품질 관리 비법
C++ 코드 품질 관리 비법C++ 코드 품질 관리 비법
C++ 코드 품질 관리 비법선협 이
 
VSTS와 Azure를 이용한 팀 프로세스 관리
VSTS와 Azure를 이용한 팀 프로세스 관리VSTS와 Azure를 이용한 팀 프로세스 관리
VSTS와 Azure를 이용한 팀 프로세스 관리Gyuwon Yi
 
Apache Hive: for business intelligence use and real-time I/O use (Korean)
Apache Hive: for business intelligence use and real-time I/O use (Korean)Apache Hive: for business intelligence use and real-time I/O use (Korean)
Apache Hive: for business intelligence use and real-time I/O use (Korean)Teddy Choi
 
2014 공개소프트웨어 대회 소프트웨어 개발 트렌드의 변화
2014 공개소프트웨어 대회 소프트웨어 개발 트렌드의 변화2014 공개소프트웨어 대회 소프트웨어 개발 트렌드의 변화
2014 공개소프트웨어 대회 소프트웨어 개발 트렌드의 변화Terry Cho
 
스위처를 만드는 아이오의 개발팀 이야기
스위처를 만드는 아이오의 개발팀 이야기스위처를 만드는 아이오의 개발팀 이야기
스위처를 만드는 아이오의 개발팀 이야기Mijeong Park
 
커뮤니티와 함께한 예비개발자 성장기- 조성수님
커뮤니티와 함께한 예비개발자 성장기- 조성수님커뮤니티와 함께한 예비개발자 성장기- 조성수님
커뮤니티와 함께한 예비개발자 성장기- 조성수님NAVER D2
 
2021년 3월 27일 개발자 이야기
2021년 3월 27일 개발자 이야기2021년 3월 27일 개발자 이야기
2021년 3월 27일 개발자 이야기Jay Park
 

Ähnlich wie PyCon2020 NLP beginner's BERT challenge (20)

삶이편해지는_백엔드_개발자_지식.pdf
삶이편해지는_백엔드_개발자_지식.pdf삶이편해지는_백엔드_개발자_지식.pdf
삶이편해지는_백엔드_개발자_지식.pdf
 
초고속 웹사이트 개발을 위한 Codeigniter PHP Framework
초고속 웹사이트 개발을 위한 Codeigniter PHP Framework초고속 웹사이트 개발을 위한 Codeigniter PHP Framework
초고속 웹사이트 개발을 위한 Codeigniter PHP Framework
 
131 deview 2013 yobi-채수원
131 deview 2013 yobi-채수원131 deview 2013 yobi-채수원
131 deview 2013 yobi-채수원
 
AngularJS In Production
AngularJS In ProductionAngularJS In Production
AngularJS In Production
 
About Programmer 2021
About Programmer 2021About Programmer 2021
About Programmer 2021
 
Golang+on+analytics+and+blockchain
Golang+on+analytics+and+blockchainGolang+on+analytics+and+blockchain
Golang+on+analytics+and+blockchain
 
백엔드 개발자로 1인분하기
백엔드 개발자로 1인분하기백엔드 개발자로 1인분하기
백엔드 개발자로 1인분하기
 
레가시 프로젝트의 빌드 자동화
레가시 프로젝트의 빌드 자동화레가시 프로젝트의 빌드 자동화
레가시 프로젝트의 빌드 자동화
 
DevOps는 원격근무를 추구하면 안되는 걸까?
DevOps는 원격근무를 추구하면 안되는 걸까?DevOps는 원격근무를 추구하면 안되는 걸까?
DevOps는 원격근무를 추구하면 안되는 걸까?
 
회사에서 새로운 기술_적용하기
회사에서 새로운 기술_적용하기회사에서 새로운 기술_적용하기
회사에서 새로운 기술_적용하기
 
200819 NAVER TECH CONCERT 07_신입 iOS 개발자 개발업무 적응기
200819 NAVER TECH CONCERT 07_신입 iOS 개발자 개발업무 적응기200819 NAVER TECH CONCERT 07_신입 iOS 개발자 개발업무 적응기
200819 NAVER TECH CONCERT 07_신입 iOS 개발자 개발업무 적응기
 
PHP로 웹개발을 해보자
PHP로 웹개발을 해보자PHP로 웹개발을 해보자
PHP로 웹개발을 해보자
 
C++ 코드 품질 관리 비법
C++ 코드 품질 관리 비법C++ 코드 품질 관리 비법
C++ 코드 품질 관리 비법
 
VSTS와 Azure를 이용한 팀 프로세스 관리
VSTS와 Azure를 이용한 팀 프로세스 관리VSTS와 Azure를 이용한 팀 프로세스 관리
VSTS와 Azure를 이용한 팀 프로세스 관리
 
Apache Hive: for business intelligence use and real-time I/O use (Korean)
Apache Hive: for business intelligence use and real-time I/O use (Korean)Apache Hive: for business intelligence use and real-time I/O use (Korean)
Apache Hive: for business intelligence use and real-time I/O use (Korean)
 
2014 공개소프트웨어 대회 소프트웨어 개발 트렌드의 변화
2014 공개소프트웨어 대회 소프트웨어 개발 트렌드의 변화2014 공개소프트웨어 대회 소프트웨어 개발 트렌드의 변화
2014 공개소프트웨어 대회 소프트웨어 개발 트렌드의 변화
 
스위처를 만드는 아이오의 개발팀 이야기
스위처를 만드는 아이오의 개발팀 이야기스위처를 만드는 아이오의 개발팀 이야기
스위처를 만드는 아이오의 개발팀 이야기
 
커뮤니티와 함께한 예비개발자 성장기- 조성수님
커뮤니티와 함께한 예비개발자 성장기- 조성수님커뮤니티와 함께한 예비개발자 성장기- 조성수님
커뮤니티와 함께한 예비개발자 성장기- 조성수님
 
2021년 3월 27일 개발자 이야기
2021년 3월 27일 개발자 이야기2021년 3월 27일 개발자 이야기
2021년 3월 27일 개발자 이야기
 
Prepo
PrepoPrepo
Prepo
 

PyCon2020 NLP beginner's BERT challenge

  • 2. 간단 소개 • 시각장애인을 위한 보행로 안내 AI
  • 3. • 시각장애인을 위한 보행로 안내 AI AI Hub 인도보행 공개 데이터 구축 간단 소개 http://www.aihub.or.kr/aidata/136 https://github.com/YoongiKim/Walk-Assistant
  • 4. • 음성, 텍스트  수화 번역 AI 간단 소개 (Example)
  • 5. • 음성, 텍스트  수화 번역 AI https://link.ainize.ai/unet-lstm-based-speech-to-sign 간단 소개
  • 6. • 지금은 대학생 (1학년) Common Computer에서 방학때부터 2달 째 인턴 중 그 동안 관심있었던 자연어처리 분야 도전! 간단 소개
  • 7. • Bidirectional Encoder Representations from Transformers https://paul-hyun.github.io/bert-01/ BERT? http://jalammar.github.io/illustrated-bert/
  • 8. • Word2Vec -> 맥락과 관계 없이 단어를 벡터화 예시) “Apple” -> [0.8, 0.1, 0.5, 0.3, …] -> RNN • BERT(Transformer) -> 문장의 맥락을 고려해서 문장을 통째로 벡터화 예시) “I ate an apple” -> [[0.3, 0.6, 0.1, …], [0.2, 0.5, 0.3, …], [0.3, 0.2, 0.9, …], [0.2, 0.5, 0.1, …]] https://medium.com/analytics-vidhya/implementing-word2vec-in-tensorflow-44f93cf2665f BERT 와 기존 방식과의 차이점
  • 9. AI의 Next step → NLP • Computer Vision [정복] • Speech Recognition [정복] ↓ (Next step) • Natural Language Processing • Logical Thinking Google Trends
  • 10. 대표적인 NLP Tasks • Language Modeling • Text Classification • Question Answering • Text Generation • Summarization • Translation --- 언어에 대한 이해, 검색어 추천 --- 감정 분석, 스팸 분류 --- 기계 독해, 지식 문답 --- 모든 종류의 글 작성 --- 개요 생성, 글 요약 --- 구글번역기, 파파고
  • 11. Question Answering Task에 관심 • BERT로 할 만한 게 뭐가 있을까? • SQuAD2.0 이라는 질의응답 Task가 있음 https://colab.research.google.com/drive/1uSlWtJdZmLrI3FCNIlUHFxwAJiSu2J0-
  • 12. KorQuAD를 해보자 "한국어를 해보고 싶은데 괜찮은 것이 없을까?" ( SQuAD는 영어 버전, KorQuAD는 한국어 버전 ) https://korquad.github.io/
  • 13. KorQuAD! 근데 엄청 어렵다! 대기업들로 꽉 찬 리더보드… 처음 배우는 내가 과연 할 수 있을까? 그것도 혼자서? 일단 해보자!
  • 14. BERT모델을 이용한 KorQuAD 2.1 도전기 • What is KorQuAD 2.1? • 한글 Wiki 백과에서 질문이 주어졌을 때 답변에 해당하는 부분(start, end)을 찾는 Task.
  • 15. KorQuAD가 중요한 이유? • Pre-Trained + Fine-Tuning로 이루어지는데 • KorQuAD는 한국어로 잘 학습된 Pre-Trained 모델과 QuestionAnswering에 적합하게 Fine-Tuning이 필요. • KorQuAD에서 잘 작동하면 한국어에 대한 전반적인 Task 정확도가 높다는 것!
  • 16. Why is Python So Good for Machine Learning? • 쓸 수 있는 라이브러리가 많다! • 생산성이 높고 이해하기 쉽다! • 다른 언어에 비해 코드가 훨씬 짧다! • 파이썬 500줄이면 C++/Java는 1000줄 이상 … https://medium.com/@UdacityINDIA/why-use-python-for-machine-learning-e4b0b4457a77
  • 17. 도전 타임라인 • 2020년 6월 24일: Common Computer 인턴 시작 - NLP 분야, BERT 모델 공부, Bert-as-service Ainize • 2020년 7월 9일: KorQuad 프로젝트 시작 - Redis Database로 Pipeline 개발 + Multiprocessing 적용 → 10시간 걸리던 전처리를 3분으로 줄임! • 2020년 8월 7일: EM=8.959 / F1=18.88 - 한국어 Evaluation 유니코드 문제점 해결 • 2020년 8월 19일: EM=48.597 / F1=66.073 [14위 Baseline 넘김] • 2020년 8월 21일: EM=65.76 / F1=75.18 [11위] 이제부터 본격적인 시작! 아직 하는 중!!
  • 18. 1. NLP 분야, BERT 모델 공부 • BERT 공부에 도움되었던 자료들 https://bit.ly/3b2ZYli
  • 19. 2. Huggingface Transformers (실행 결과) • PyTorch + Tensorflow 2.0 환경으로 아주 간단하게 BERT 모델을 돌릴 수 있는 library
  • 20. KorQuAD 2.0 데이터셋 (7GB .json.zip)
  • 21. 3. SQuAD에 KorQuAD v2 데이터를 넣어보자! • Raw Text → Tokenized → Labeled Values → Model → (start, end) → Result • 영어의 경우 • Raw Text 1byte → Tokenized String 1byte • 한글의 경우 • Raw Text 2~4bytes → Tokenized String x3 bytes -> 한 문장을 처리하는데도 메모리 사용량이 급증
  • 22. 4. Redis Database로 Pipeline 개발 • 기본 SQuAD 데이터셋은 40MB (v2) KorQuAD 데이터셋은 7GB (v2.1) • KorQuAD 데이터셋은 JSON으로, 한 파일 안에 1,000개의 질문과 답변 → 이걸 한번에 로딩해서 각 단계에서 필요한 정보를 가져오는 것은 매우 비효율적 • JSON Loads + Tokenize == 200GB+ 메모리 필요! • JSON → Redis Tokenized Result → Redis Label & Dictionary → Redis == 70GB Memory 달성!
  • 23. + CPU 256개 멀티 프로세싱 전처리 과정에 걸리는 시간을 10시간→ 3분으로 단축
  • 24. + Profiler로 최적화 대용량의 JSON/CSV를 Memory-efficient하게 읽어들이기 위해 Pandas 라이브러리를 썼으나, 비효율적임을 확인할 수 있었음
  • 26. 5. 한글 유니코드 차이로 인한 오작동 해결 • NFD(조합형), NFC(완성형) 차이로 인한 Evaluation 문제 파 이 콘 2 0 2 0 [PAD] [PAD] [PAD] ↕ ↕ ↕ ↕ ↕ ↕ ↕ ↕ ↕ ↕ ㅍ ㅏ ㅇ ㅣ ㅋ ㅗ ㄴ 2 0 2 정답 모델 출력 결과
  • 27. 아직 NLP 시작한지 2달 밖에 안 지났지만… • 처음에 불가능해 보였던 목표에 어느정도 근접 • Research 보다는 Engineering 과정이 훨씬 많았음. • 사실상 2달 동안 전처리만 함… • Vision과는 비교도 안되게 복잡한 전처리… • 그래도 baseline은 넘겼음. 이제부터 본격적인 연구 가능할 듯!
  • 29. GPT-3 특징 • 모델의 크기를 키우면 General한 Task에 쓸 수 있다! https://mc.ai/gpt-3-the-new-mighty-language-model-from-openai-2/ https://www.zdnet.com/article/openais-gigantic-gpt-3-hints-at-the-limits-of-language-models-for-ai/
  • 30. 한국어 GPT-3를 만들고 싶다! 영어만 학습이 가능해서, 한국어 → 영어 → 한국어로 번역해야 함.
  • 31. 앞으로 계획 • KorQuAD 2.0 의미있는(1th?) 점수 찍기 • 한글 GPT 모델 만들어보기! • 잘 만들어서 Ainize API로 공개하기! 해보고 싶은 프로젝트? • 학교 과제 대신해주는 AI (개요 -> 에세이) • 문서 작성 자동화
  • 32. 개인이 돌리기엔 모델이 너무 크다... 개인 GPU에서는 학습 조차 어려움… GPU 메모리 12기가는 되어야... (GTX-1080TI가 8기가인데?) https://www.neowin.net/news/nvidia-registers-the-worlds-quickest-bert-training-time-and-largest-transformer-based-model/
  • 33. 로 Bert API 돌려보기 github.com/hanxiao/bert-as-service -> link.ainize.ai/bert-as-a-service
  • 34. github.com/konlpy/konlpy -> link.ainize.ai/konlpy 로 KoNLPy API 돌려보기 OpenSource-as-a-Service Platform 무거운 모델, GPU가 필요한 코드까지 Ainize로 올려보세요! https://ainize.ai/
  • 35. Common Computer에서 동료들과 함께 성장해 나갈 개발자를 찾습니다. 채용 문의 phillip@comcom.ai https://comcom.ai > Careers