File size: 763 Bytes
1591c0c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from engine import PipeOwlEngine, PipeOwlConfig
import time

#=== timetest ===
"""

t0 = time.perf_counter()

"""
#================

engine = PipeOwlEngine(PipeOwlConfig())

#=== timetest ===
"""

t1 = time.perf_counter()

print(f"\n🚀 Cold start time: {(t1 - t0)*1000:.2f} ms\n")

#""

for _ in range(20):

    t0 = time.perf_counter()

    engine.pipeowl("雪鴞")

    print((time.perf_counter() - t0) * 1000, "ms")

"""
#================
        
while True:

    print()
    query = input("請輸入句子: ")

    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()