Download quickstart.py from WangKaiLin/PipeOwl-1.4-multilingual: direct link, hf CLI and curl.
- Browser
- Download file 541 Bytes
-
https://huggingface.co/WangKaiLin/PipeOwl-1.4-multilingual/resolve/main/quickstart.py
- Command line
-
hf download hf://WangKaiLin/PipeOwl-1.4-multilingual/quickstart.py
-
curl -L -o quickstart.py https://huggingface.co/WangKaiLin/PipeOwl-1.4-multilingual/resolve/main/quickstart.py
541 Bytes
| from engine import PipeOwlEngine, PipeOwlConfig | |
| # import time | |
| engine = PipeOwlEngine(PipeOwlConfig()) | |
| """ | |
| # latency test code | |
| for _ in range(20): | |
| t0 = time.perf_counter() | |
| engine.pipeowl("雪鴞") | |
| print((time.perf_counter() - t0) * 1000, "ms") | |
| """ | |
| while True: | |
| query = input("Please enter words: ") | |
| out = engine.pipeowl(query, top_k=5) | |
| print("\nTop-K Tokens:") | |
| for text, score in out["retrieved"]: | |
| print(f"{score:.3f} | {text}") | |
| print("\nDecoded:") | |
| print(out["decoded"]) | |
| print() | |