transformers
copied
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Readme
Files and versions
24 lines
903 B
24 lines
903 B
from towhee import triton_client
|
|
import sys
|
|
import time
|
|
|
|
num = int(sys.argv[-1])
|
|
client = triton_client.Client(url='localhost:8000')
|
|
|
|
data = 'hello'
|
|
# data = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'
|
|
|
|
res = client(data)
|
|
print(res[0][0].shape)
|
|
|
|
res = client([data])
|
|
print(len(res[0][0]), res[0][0][0].shape)
|
|
|
|
# Or run data with batch
|
|
start = time.time()
|
|
res = client.batch([data] * num, batch_size=8)
|
|
end = time.time()
|
|
print(num / (end-start))
|
|
# print(len(res), res[0][0][0].shape)
|
|
|
|
client.close()
|