File size: 387 Bytes
29f25be
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
"""Child process capturing SentencePiece's native C++ training diagnostics."""
import json
import sys
from pathlib import Path


def main():
    import sentencepiece as spm
    request = json.loads(Path(sys.argv[1]).read_text(encoding='utf-8'))
    spm.set_random_generator_seed(request['seed'])
    spm.SentencePieceTrainer.train(**request['options'])


if __name__=='__main__': main()