더북(TheBook)

이 토크나이저의 사용법은 앞서 구현한 SimpleTokenizerV2encode 메서드 사용법과 비슷합니다.

text = (
    "Hello, do you like tea? <|endoftext|> In the sunlit terraces"
    " of someunknownPlace."
)
integers = tokenizer.encode(text, allowed_special={"<|endoftext|>"})
print(integers)

이 코드는 다음과 같은 토큰 ID를 출력합니다.

[15496, 11, 466, 345, 588, 8887, 30, 220, 50256, 554, 262, 4252, 18250, 8812, 2114, 286, 617, 34680, 27271, 13]
신간 소식 구독하기
뉴스레터에 가입하시고 이메일로 신간 소식을 받아 보세요.