Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

async_predict error when coroutines too high #34

Open
Liangtaiwan opened this issue May 3, 2019 · 0 comments
Open

async_predict error when coroutines too high #34

Liangtaiwan opened this issue May 3, 2019 · 0 comments

Comments

@Liangtaiwan
Copy link

Liangtaiwan commented May 3, 2019

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!")
@Liangtaiwan Liangtaiwan changed the title async_predict error when too many requests async_predict error when coroutines too high May 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant