|
Download runtime/README.md from iapp/OpenThai2.0-NLP-Core-Lite: direct link, hf CLI and curl.
- Browser
- Download file 2.54 kB
-
https://huggingface.co/iapp/OpenThai2.0-NLP-Core-Lite/resolve/main/runtime/README.md
- Command line
-
hf download hf://iapp/OpenThai2.0-NLP-Core-Lite/runtime/README.md
-
curl -L -o README.md https://huggingface.co/iapp/OpenThai2.0-NLP-Core-Lite/resolve/main/runtime/README.md
2.54 kB
| # Hand-off kit of OpenThai2.0-NLP-Core-Lite (internal) | |
| This folder is for the iapp-ai team. It is internal to this private repository, and whether it stays when the | |
| repository goes public is the owner's decision. | |
| | File | What it is | | |
| |---|---| | |
| | `HANDOFF.md` | the guideline: the API, the results, the speed, what changed in each version and the open decisions | | |
| | `PYPI.md` | the release on PyPI through `iapp-ai[nlp]`, and the update to 0.2.2 | | |
| | `tests/` | 31 tests (one for each item of your review among them), and `golden.json` with the stored output of every function and of the pipeline on 9 texts | | |
| | `example.py` | the whole pipeline in one call, then every function, on one text | | |
| | `bench.py` | characters per second on one thread | | |
| The package is the wheel at the root of this repository, `openthai2_0_nlp_core_lite-0.2.2-py3-none-any.whl`. It holds | |
| the runtime, the model (10 files, 30.6 MB, int8) and the word segmenter's dictionary and character table, so it | |
| needs only NumPy and ONNX Runtime. | |
| ## Setup | |
| Downloading needs an account in the iapp organization on Hugging Face and a read token (`hf auth login`, or | |
| `HF_TOKEN`). | |
| ```bash | |
| pip install -U huggingface_hub pytest | |
| hf download iapp/OpenThai2.0-NLP-Core-Lite --include "openthai2_0_nlp_core_lite-0.2.2-py3-none-any.whl" --include "runtime/*" --local-dir nlp-core-lite | |
| pip install nlp-core-lite/openthai2_0_nlp_core_lite-0.2.2-py3-none-any.whl # brings NumPy and ONNX Runtime | |
| cd nlp-core-lite/runtime | |
| python -m pytest tests # 31 passed | |
| python example.py | |
| ``` | |
| ```python | |
| from openthai_nlp_core_lite import analyze, pos_tag | |
| doc = analyze("นายกรัฐมนตรีเดินทางไปเชียงใหม่เมื่อวานนี้") # every task: sentences, clauses, words, POS, NER, both trees | |
| doc.sentences[0].words[0] # Word(id=1, text='นายก', upos='NOUN', xpos='NCMN', head=3, deprel='nsubj', start=0, end=4) | |
| analyze(text, tasks=["pos", "ner"]) # only some tasks | |
| pos_tag("นายกรัฐมนตรีเดินทางไปเชียงใหม่เมื่อวานนี้") # one function per task: the same results | |
| ``` | |
| ## What to report | |
| - the test result on each platform and Python version you support (the wheel needs Python 3.10 or later); | |
| - any output that differs from `tests/golden.json`; | |
| - the speed from `python bench.py LINES.txt` (and `--batch 64`) on your machines; | |
| - the test results with 0.2.2 inside iapp-ai, as `PYPI.md` asks. | |