Skip to Content
파이토치로 배우는 LLM & AI
book

파이토치로 배우는 LLM & AI

by 로런스 모로니, 박해선
March 2026
Intermediate
504 pages
11h 26m
Korean
Hanbit Media, Inc.
Content preview from 파이토치로 배우는 LLM & AI
237
8
장
머신러닝으로 텍스트 생성하기
이런 작업을 대신해 주는 라이브러리와 헬퍼 함수는 많습니다. 따라서 이 장의 코드 대신에 해
당 함수를 사용해도 괜찮습니다. 하지만 내부에서 어떻게 동작하는지 보여 주기 위해 이 코드
를 작성했습니다.
변환된 결과는 [그림
8
-
4
]와 같습니다.
Labels:
Xs:
Sentence:
[0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0
....]
[1, 2, 3, 4, 5, 6, 7, 8]
[0, 1, 2, 3, 4, 5, 6, 7]
[8]
Ys:
문장:
Xs
:
레이블:
Ys
:
그림
8-4
원-핫 인코딩된 레이블
이는 매우 희소한(즉
0
이 많은) 표현입니다. 훈련 데이터와 단어가 많다면 메모리가 금방 부족
해질 겁니다. 훈련 데이터에 문장이
100
,
000
개 있고
10
,
000
개의 단어가 있다면 레이블을 담
기 위해
1
,
000
,
000
,
000
바이트가 필요합니다. 하지만 단어를 분류하고 예측하려면 이렇게 신
경망을 설계해야 합니다.
1
8.2
모델 만들기
이제 이 입력 데이터로 훈련할 수 있는 간단한 모델을 만들어 보죠. 모델은 임베딩 층,
LSTM
층, 밀집 층으로 구성됩니다.
임베딩에서는 단어 하나당 벡터 하나가 필요합니다. ...
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

PyTorch의 코더를 위한 AI 및 ML

PyTorch의 코더를 위한 AI 및 ML

Laurence Moroney
헤드 퍼스트 자바(3판)

헤드 퍼스트 자바(3판)

케이시 시에라, 버트 베이츠

Publisher Resources

ISBN: 9791175790223