File size: 718 Bytes
818b1b2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | """Download the minimal CPU release and run word-level LID."""
import importlib.util
from pathlib import Path
from huggingface_hub import snapshot_download
directory=Path(snapshot_download("failed09/bashkir-roberta-token-lid", allow_patterns=[
"onnx/model_int8.onnx", "spm_bashkir_bert_16k.model", "config.json", "META.json", "runtime.py"]))
spec=importlib.util.spec_from_file_location("bashkir_token_lid_runtime",directory/"runtime.py")
runtime=importlib.util.module_from_spec(spec)
spec.loader.exec_module(runtime)
lid=runtime.BashkirTokenLID(directory)
for token in lid.predict("Ул миңә see you tomorrow тип әйтте, значит завтра встретимся."):
print(token)
|