입력과 토큰 하나만큼 이동시킨 타깃을 사용해 다음 단어 예측 작업(그림 2-12 참조)을 구성할 수 있습니다.
for i in range(1, context_size+1):
context = enc_sample[:i]
desired = enc_sample[i]
print(context, "---->", desired)
출력은 다음과 같습니다.
[290] ----> 4920 [290, 4920] ----> 2241 [290, 4920, 2241] ----> 287 [290, 4920, 2241, 287] ----> 257