Skip to Content
딥 러닝을 위한 PyTorch 프로그래밍
book

딥 러닝을 위한 PyTorch 프로그래밍

by Ian Pointer
May 2025
Beginner to intermediate
220 pages
3h 37m
Korean
O'Reilly Media, Inc.
Content preview from 딥 러닝을 위한 PyTorch 프로그래밍

5장. 텍스트 분류

이 작품은 AI를 사용하여 번역되었습니다. 여러분의 피드백과 의견을 환영합니다: translation-feedback@oreilly.com

지금은 이미지를 뒤로하고 딥 러닝이 기존 기술을 크게 발전시킨 것으로 입증된 또 다른 영역인 자연어 처리(NLP)로 관심을 돌리겠습니다. 이에 대한 좋은 예가 Google 번역입니다. 원래 번역을 처리하는 코드는 500,000줄에 달하는 무거운 코드였습니다. 새로운 TensorFlow 기반 시스템은 약 500개이며 이전 방식보다 성능이 더 우수합니다.

4장에서 배운 전이 학습을 NLP 문제에 적용하는 데 있어서도 최근 획기적인 발전이 이루어졌습니다. 트랜스포머 아키텍처와 같은 새로운 아키텍처를 통해 OpenAI의 GPT-2와 같은 네트워크가 만들어졌으며, 이 네트워크의 더 큰 변형은 거의 인간과 유사한 품질의 텍스트를 생성합니다(실제로 OpenAI는 이 모델이 악의적으로 사용될 것을 우려하여 가중치를 공개하지 않았습니다).

이 장에서는 순환 신경망과 임베딩에 대해 간략하게 살펴봅니다. 그런 다음 torchtext 라이브러리를 살펴보고 LSTM 기반 모델을 사용한 텍스트 처리에 사용하는 방법을 알아봅니다.

순환 신경망(Recurrent Neural Network+)

지금까지 CNN 기반 아키텍처를 어떻게 사용해왔는지 되돌아보면, 항상 하나의 완전한 시간 스냅샷을 기반으로 작업해 왔다는 것을 알 수 있습니다. 하지만 이 두 문장 조각을 생각해 보세요:

The cat sat on the mat.

She got up and impatiently climbed on the chair, meowing for food.

이 두 문장을 차례로 CNN에 입력한 후 " 고양이는 어디에 있나요? "라고 질문한다고 가정해 보겠습니다 . 네트워크에는 메모리 개념이 없기 때문에 문제가 발생할 것입니다. 이는 시간적 영역이 있는 데이터(예: 텍스트, 음성, 동영상, 시계열 데이터)를 다룰 때 매우 중요합니다.1 순환 신경망 (RNN)은 숨겨진 상태를 통해 신경망에 메모리를 부여함으로써 이 문제를 해결합니다.

RNN은 어떻게 생겼나요? 제가 가장 좋아하는 설명은 " for 루프가 교차된 신경망을 상상해 보세요."입니다. 그림 5-1은 고전적인 RNN 구조의 다이어그램을 보여줍니다.

Classical RNN diagram
그림 5-1. RNN

시간 단계 t에 입력을 추가하면 숨겨진 출력 상태 ht를 얻고, 출력은 다음 시간 단계를 위해 RNN에 다시 피드백됩니다. 그림 5-2와 같이 이 네트워크를 풀어서 무슨 일이 일어나고 있는지 자세히 살펴볼 수 있습니다.

Unrolled RNN diagram
그림 5-2. 언롤링된 RNN
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

AI를 위한 필수 수학

AI를 위한 필수 수학

할라 넬슨
처음 시작하는 딥러닝

처음 시작하는 딥러닝

심효섭, 세스 와이드먼

Publisher Resources

ISBN: 9798341656048