A utility for storing and reading files for Korean LM training.
Project description
ko_lm_dataformat
-
한국어 언어모델 학습 데이터를 저장하기 위한 유틸리티
-
코드는 EleutherAI에서 사용하는 lm_dataformat를 참고하여 제작.
- 일부 버그 수정
- 한국어에 맞게 기능 추가 및 수정 (sentence splitter, text cleaner)
Install
pip install ko_lm_dataformat
What have been changed
기능 추가
- Sentence splitter
kss v1.3.1
로직 변경
- 기존과 달리
json
의"text"
는 무조건 하나의 document만 받음.str
이 아닌List[str]
로 들어오게 되면 기존에는 각 str이 document였으나, 여기서는 sentence로 취급.- 기존에는 여러 document를
\n\n
으로 join 하였지만,ko_lm_dataformat
에서는 해당 로직을 없앰.
Usage
To write:
import ko_lm_dataformat as kldf
ar = kldf.Archive('output_dir')
for x in something():
# do other stuff
ar.add_data(somedocument, meta={
'example': stuff,
'someothermetadata': [othermetadata, otherrandomstuff],
'otherotherstuff': True
})
# remember to commit at the end!
ar.commit()
To read:
import ko_lm_dataformat as kldf
rdr = kldf.Reader('input_dir_or_file')
for doc in rdr.stream_data(get_meta=False):
# do something with the document
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for ko_lm_dataformat-0.1.0rc3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f692748e0c399e72cdb9515ca6cf7b47f9c0996b642159892986a317e65e8b2d |
|
MD5 | a6c808fc8d4e30320237aa144dd70d06 |
|
BLAKE2b-256 | 7e41dc951488fdb4e4447d9fc7a78bc518ad493465c4fb7439f914a239635dd2 |
Close
Hashes for ko_lm_dataformat-0.1.0rc3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 896bffcc464f96632155cea915a1083dd4458ba68395f730317912d9cca28367 |
|
MD5 | 12d77764f67108a6ccd6a282c61739f0 |
|
BLAKE2b-256 | 99312252dfaf241b5168754bb70dacf4ead7066a1b67d8d79f5a53571ac01413 |