Giter Site home page Giter Site logo

How to execute own queries? about gap-text2sql HOT 9 OPEN

awslabs avatar awslabs commented on June 16, 2024
How to execute own queries?

from gap-text2sql.

Comments (9)

Impavidity avatar Impavidity commented on June 16, 2024 3

Hey Kevin,

Thanks for your question. So the terminal usually will be a cell value: it could be a float/integer or a string.
It usually involves some value copy mechanism to do it; but currently the model doesn't support it.

However, there is a simple solution for this:
If it is number, you can easily detect the number in the utterance and directly fill it in the generated SQL. For string type, you can match the n-gram against the value in the databases: if it matched, it would be a string value for the corresponding column.

I think above is a simple solution for this. I have a script to achieve this but it takes time to clean it and make it public. You can try this method out because that is pretty simple.

And I will try to make the script public as soon as possible if you did not implement it by yourself.

Peng

from gap-text2sql.

kev2513 avatar kev2513 commented on June 16, 2024 1

Hello @thecodemakr,

I got the same issue executing Inference solved the problem for me:

python run.py preprocess experiments/spider-configs/gap-run.jsonnet

(also execute the Preprocess dataset step in advance)

from gap-text2sql.

Impavidity avatar Impavidity commented on June 16, 2024

Hey,
Thanks for your interests on our work. You can checkout the pull request #6 when it is merged. I think you can run your own database and queries based on the notebook I provided.

Let me know if it works for you and let me know if you have any further questions.

Peng

from gap-text2sql.

kev2513 avatar kev2513 commented on June 16, 2024

Hello Peng,

Thank you very much for your quick response! I tried the notebook and it worked 👍 I will let you know if I have any questions. Have a nice weekend.

Kevin

from gap-text2sql.

kev2513 avatar kev2513 commented on June 16, 2024

Hello Peng,

I made further tests and figured out that the response sometimes contains the word 'terminal' for example:

Query: department with budget greater then 10 billion

Answer: SELECT department.Department_ID FROM department WHERE department.Budget_in_Billions > 'terminal'

I guess 'terminal' should be replaced the words contained in the query. How can the replacement be achieved?

Sincerely
Kevin

from gap-text2sql.

kev2513 avatar kev2513 commented on June 16, 2024

Hey Peng,

Thank you very much for your explanation. I will try my best :)

Sincerely
Kevin

from gap-text2sql.

thecodemakr avatar thecodemakr commented on June 16, 2024

Hi @Impavidity @kev2513 , I get the following error on trying the notebook -

WARNING <class 'seq2struct.models.enc_dec.EncDecModel.Preproc'>: superfluous {'name': 'EncDec'}
---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-21-d986dbd802ee> in <module>()
----> 1 inferer = Inferer(infer_config)

4 frames
/content/gap-text2sql/rat-sql-gap/seq2struct/commands/infer.py in __init__(self, config)
     34             registry.lookup('model', config['model']).Preproc,
     35             config['model'])
---> 36         self.model_preproc.load()
     37 
     38     def load_model(self, logdir, step):

/content/gap-text2sql/rat-sql-gap/seq2struct/models/enc_dec.py in load(self)
     54 
     55         def load(self):
---> 56             self.enc_preproc.load()
     57             self.dec_preproc.load()
     58 

/content/gap-text2sql/rat-sql-gap/seq2struct/models/spider/spider_enc.py in load(self)
   1272 
   1273     def load(self):
-> 1274         self.tokenizer = BartTokenizer.from_pretrained(self.data_dir)
   1275 
   1276 

/usr/local/lib/python3.7/dist-packages/transformers/tokenization_utils_base.py in from_pretrained(cls, *inputs, **kwargs)
   1138 
   1139         """
-> 1140         return cls._from_pretrained(*inputs, **kwargs)
   1141 
   1142     @classmethod

/usr/local/lib/python3.7/dist-packages/transformers/tokenization_utils_base.py in _from_pretrained(cls, pretrained_model_name_or_path, *init_inputs, **kwargs)
   1244                     ", ".join(s3_models),
   1245                     pretrained_model_name_or_path,
-> 1246                     list(cls.vocab_files_names.values()),
   1247                 )
   1248             )

OSError: Model name 'data/spider-bart/nl2code-1115,output_from=true,fs=2,emb=bart,cvlink/enc' was not found in tokenizers model name list (facebook/bart-base, facebook/bart-large, facebook/bart-large-mnli, facebook/bart-large-cnn, facebook/bart-large-xsum, yjernite/bart_eli5). We assumed 'data/spider-bart/nl2code-1115,output_from=true,fs=2,emb=bart,cvlink/enc' was a path, a model identifier, or url to a directory containing vocabulary files named ['vocab.json', 'merges.txt'] but couldn't find such vocabulary files at this path or url.

Can you please help me with what step am I missing?

from gap-text2sql.

alan-ai-learner avatar alan-ai-learner commented on June 16, 2024

Can you pls tell me that, How much time this command will run "python run.py preprocess experiments/spider-configs/gap-run.jsonnet", i'm running it for like an hr

from gap-text2sql.

roburst2 avatar roburst2 commented on June 16, 2024

Hi @Impavidity @kev2513 , I get the following error on trying the notebook -

WARNING <class 'seq2struct.models.enc_dec.EncDecModel.Preproc'>: superfluous {'name': 'EncDec'}
---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-21-d986dbd802ee> in <module>()
----> 1 inferer = Inferer(infer_config)

4 frames
/content/gap-text2sql/rat-sql-gap/seq2struct/commands/infer.py in __init__(self, config)
     34             registry.lookup('model', config['model']).Preproc,
     35             config['model'])
---> 36         self.model_preproc.load()
     37 
     38     def load_model(self, logdir, step):

/content/gap-text2sql/rat-sql-gap/seq2struct/models/enc_dec.py in load(self)
     54 
     55         def load(self):
---> 56             self.enc_preproc.load()
     57             self.dec_preproc.load()
     58 

/content/gap-text2sql/rat-sql-gap/seq2struct/models/spider/spider_enc.py in load(self)
   1272 
   1273     def load(self):
-> 1274         self.tokenizer = BartTokenizer.from_pretrained(self.data_dir)
   1275 
   1276 

/usr/local/lib/python3.7/dist-packages/transformers/tokenization_utils_base.py in from_pretrained(cls, *inputs, **kwargs)
   1138 
   1139         """
-> 1140         return cls._from_pretrained(*inputs, **kwargs)
   1141 
   1142     @classmethod

/usr/local/lib/python3.7/dist-packages/transformers/tokenization_utils_base.py in _from_pretrained(cls, pretrained_model_name_or_path, *init_inputs, **kwargs)
   1244                     ", ".join(s3_models),
   1245                     pretrained_model_name_or_path,
-> 1246                     list(cls.vocab_files_names.values()),
   1247                 )
   1248             )

OSError: Model name 'data/spider-bart/nl2code-1115,output_from=true,fs=2,emb=bart,cvlink/enc' was not found in tokenizers model name list (facebook/bart-base, facebook/bart-large, facebook/bart-large-mnli, facebook/bart-large-cnn, facebook/bart-large-xsum, yjernite/bart_eli5). We assumed 'data/spider-bart/nl2code-1115,output_from=true,fs=2,emb=bart,cvlink/enc' was a path, a model identifier, or url to a directory containing vocabulary files named ['vocab.json', 'merges.txt'] but couldn't find such vocabulary files at this path or url.

Can you please help me with what step am I missing?

@thecodemakr I am also facing the issue while running the notebook
How did you resolve this

from gap-text2sql.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.