Jupyter notebook 사용 기준으로 설치 및 사용법을 설명합니다. Sentencepiece 특징 및 기능 설명은 다음 사이트에서 참고 바랍니다. https://sungwoony.blogspot.com/2020/04/sentencepiece.html one-sentence-per-line raw corpus file. tokenizer, normalizer 또는 preprocessor를 실행할 필요가 없습니다. Default로, Unicode NFKC로 SentencePiece input을 정규화 합니다. 설치방법 VM환경에 pip library가 설치되어 있어야 하며, 다음 명령어를 수행하면 설치됩니다. pip install sentencepiece 사용법 Sentencepiece library import setencepiece를 import해야 하며 관례적으로 spm으로 사용합니다. Train SentencePiece Model from corpuse botchan.txt 파일을 다음 사이트에서 다운로드 받을 수 있습니다. https://github.com/google/sentencepiece/blob/master/data/botchan.txt --mode_type의 기본은 uni type입니다. --model_type에 bpe를 넣으면 bpe 타입으로 생성됩니다. Train이 완료되면 "m.uni.model"과 "m.bpe.model" 이 생성됩니다. 둘 의 차이점은 다음에 확인할 수 있습니다. Option Name Description input 파일목록은 쉼표로 구분합니다. model_prefix output model로 prefix. <model_name>.model과 <model_name>.vocab 이 생성됩니다. vocab_size vocabulary size, e.g.. 8000, 16000, o...


댓글
댓글 쓰기