-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
async_predict error when coroutines too high
for example
async def speed_testing_async_encode(self, batch_size: int = 32) -> np.ndarray:
'''
This function is for async_encode speed test.
You should NOT use this for normal encoding.
'''
coros = []
max_len = self.get_pad_maxlen()
for _ in range(10000):
coro = self.client.async_predict(
data=[
PredictInput(name='x', value=[list(range(max_len))]),
PredictInput(name='seqlen', value=[max_len]),
],
output_names=['latent_vector'],
model_name=self.model_name,
model_signature_name='encode',
)
coros.append(coro)
await asyncio.gather(*coros)
def get_pad_maxlen(self):
for step_info in self.pipe._step_info:
if step_info['op_name'] == 'Pad':
return step_info['op_kwargs']['maxlen']
raise KeyError("Can't find any `Pad` operation in pipe!")
Metadata
Metadata
Assignees
Labels
No labels