Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SEP], [CLS] 등 스페셜 토큰의 토크나이저 이슈 #11

Closed
haven-jeon opened this issue Dec 17, 2019 · 4 comments
Closed

[SEP], [CLS] 등 스페셜 토큰의 토크나이저 이슈 #11

haven-jeon opened this issue Dec 17, 2019 · 4 comments

Comments

@haven-jeon
Copy link
Collaborator

haven-jeon commented Dec 17, 2019

> tokenizer('[CLS] 감사합니다. [SEP]')
['▁[', 'C', 'LS', ']', '▁감사', '합니다', '.', '▁[', 'S', 'E', 'P', ']']

현재로서는 아래와 같은 방식으로 우회해야 됨

> ['[CLS]', ] + tokenizer('감사합니다. ') + ['[SEP]', ]

구글 protobuf를 수정하는 방식으로 기존 tokenizer 모델을 아래와 같이 수정하여 재 등록 해야 됨

google/sentencepiece#426
google/sentencepiece#306

@robinsongh381
Copy link

[CLS] 토큰에 대한 임베딩 값이 필요할 경우 어떻게해야 하나요 ?

@haven-jeon
Copy link
Collaborator Author

haven-jeon commented Dec 18, 2019

논문을 보시면 아시겠지만 [CLS]토큰은 이미 vocab에 들어가 있고 네트워크 내 토큰 임베딩으로 학습이 되어 있습니다. 따라서 모델을 로딩하고 임베딩 값을 뽑아 쓰시면 됩니다.

참고로 해당 질문은 이 이슈하고는 관련이 없는거 같습니다...

haven-jeon added a commit that referenced this issue Dec 19, 2019
haven-jeon added a commit that referenced this issue Dec 19, 2019
@haven-jeon
Copy link
Collaborator Author

haven-jeon commented Dec 19, 2019

not fixed.

In [4]: tokenizer('[CLS] 감사합니다. [SEP]')                                                                                                                                                                                                                                        
Out[4]: ['▁', '[CLS]', '▁감사', '합니다', '.', '▁', '[SEP]']

@haven-jeon
Copy link
Collaborator Author

해당 이슈는 follow up 이 없기 때문에 당분간 close합니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants