Closed Ultra-Seven closed 3 years ago
Hi @Ultra-Seven,
You can use the serve_seq2seq.py
program to do that. When you call it, set
https://github.com/ElementAI/picard/blob/d84620ab93296fbd889e90737352783022ac790b/seq2seq/serve_seq2seq.py#L42-L45
to the folder in which you have your sqlite database files. The structure of that folder should be like this:
databaseA/databaseA.sqlite
databaseB/databaseB.sqlite
...
where databaseA
and databaseB
are the db_id
s of the databases. Once the program is up and running, use the swagger UI to test inference with the ask
endpoint.
I'm going to make a target in the Makefile
, too, to make all this easier.
Torsten
Hi @tscholak, thank you for your quick reply! I followed your instruction and was able to initialize the server. But when I tried to send a request, it reported an error: ERROR: Exception in ASGI application Traceback (most recent call last): File "/Users/tracy/opt/anaconda3/envs/picard/lib/python3.7/site-packages/uvicorn/protocols/http/h11_impl.py", line 373, in run_asgi result = await app(self.scope, self.receive, self.send) File "/Users/tracy/opt/anaconda3/envs/picard/lib/python3.7/site-packages/uvicorn/middleware/proxy_headers.py", line 75, in call return await self.app(scope, receive, send) File "/Users/tracy/opt/anaconda3/envs/picard/lib/python3.7/site-packages/fastapi/applications.py", line 208, in call await super().call(scope, receive, send) File "/Users/tracy/opt/anaconda3/envs/picard/lib/python3.7/site-packages/starlette/applications.py", line 112, in call await self.middleware_stack(scope, receive, send) File "/Users/tracy/opt/anaconda3/envs/picard/lib/python3.7/site-packages/starlette/middleware/errors.py", line 181, in call raise exc from None File "/Users/tracy/opt/anaconda3/envs/picard/lib/python3.7/site-packages/starlette/middleware/errors.py", line 159, in call await self.app(scope, receive, _send) File "/Users/tracy/opt/anaconda3/envs/picard/lib/python3.7/site-packages/starlette/exceptions.py", line 82, in call raise exc from None File "/Users/tracy/opt/anaconda3/envs/picard/lib/python3.7/site-packages/starlette/exceptions.py", line 71, in call await self.app(scope, receive, sender) File "/Users/tracy/opt/anaconda3/envs/picard/lib/python3.7/site-packages/starlette/routing.py", line 580, in call await route.handle(scope, receive, send) File "/Users/tracy/opt/anaconda3/envs/picard/lib/python3.7/site-packages/starlette/routing.py", line 241, in handle await self.app(scope, receive, send) File "/Users/tracy/opt/anaconda3/envs/picard/lib/python3.7/site-packages/starlette/routing.py", line 52, in app response = await func(request) File "/Users/tracy/opt/anaconda3/envs/picard/lib/python3.7/site-packages/fastapi/routing.py", line 227, in app dependant=dependant, values=values, is_coroutine=is_coroutine File "/Users/tracy/opt/anaconda3/envs/picard/lib/python3.7/site-packages/fastapi/routing.py", line 161, in run_endpoint_function return await run_in_threadpool(dependant.call, values) File "/Users/tracy/opt/anaconda3/envs/picard/lib/python3.7/site-packages/starlette/concurrency.py", line 40, in run_in_threadpool return await loop.run_in_executor(None, func, args) File "/Users/tracy/opt/anaconda3/envs/picard/lib/python3.7/concurrent/futures/thread.py", line 57, in run result = self.fn(self.args, self.kwargs) File "/Users/tracy/Documents/Research/picard/seq2seq/serve_seq2seq.py", line 127, in ask outputs = pipe(inputs=question, db_id=db_id) File "/Users/tracy/Documents/Research/picard/seq2seq/utils/pipeline.py", line 84, in call outputs = self._generate(inputs, return_tensors, return_text, clean_up_tokenization_spaces, generate_kwargs) AttributeError: 'Text2SQLGenerationPipeline' object has no attribute '_generate'
I use the Transformer 4.11.3 and keep the same version as the configuration file. Could you please help me solve this error? Thanks!
Hi, the problem is this upstream PR, https://github.com/huggingface/transformers/pull/13308. I wasn't aware of these changes when I bumped the transformers version. I need to rewrite the Text2SQL pipeline to make it work again. Let's hope I can figure this out quickly.
It's done. Please run make serve
. Additional instructions here: https://github.com/ElementAI/picard#serving
Hi, it works perfectly! Thank you for your help!
I'm glad I could help!
I am wondering how can I use this model on a new database like what DuoRat supports? Thank you!