Giter VIP home page Giter VIP logo

x-lance / text2sql-lgesql Goto Github PK

View Code? Open in Web Editor NEW
143.0 143.0 38.0 297 KB

[ACL 2021] This is the project containing source codes and pre-trained models about ACL2021 Long Paper ``LGESQL: Line Graph Enhanced Text-to-SQL Model with Mixed Local and Non-Local Relations".

Home Page: https://arxiv.org/abs/2106.01093

License: Apache License 2.0

Python 97.93% Shell 2.07%
database heterogeneous-graph-neural-network natural-language-interface semantic-parsing structured-prediction text-to-sql

text2sql-lgesql's People

Contributors

rhythmcao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

text2sql-lgesql's Issues

The program crashes when I use the argument "--load_optimizer"

I wanted to continue training the model with the saved optimizer, but it crashed. The traceback is shown as follows:
Traceback (most recent call last):
File "lgesql/text2sql.py", line 105, in
optimizer.step()
File "lib/python3.6/site-packages/torch/optim/lr_scheduler.py", line 65, in wrapper
return wrapped(*args, **kwargs)
File "lib/python3.6/site-packages/torch/optim/optimizer.py", line 88, in wrapper
return func(*args, **kwargs)
File "lgesql/utils/optimization.py", line 220, in step
exp_avg.mul_(beta1).add_(grad, alpha=1.0 - beta1)
RuntimeError: The size of tensor a (768) must match the size of tensor b (2) at non-singleton dimension 0

Have you met this problem? And how can I fix it?

Question about the edge features

Hi,I want to confirm that how to Initial the edge features and non-local edge features from the parameter matrix, is similar to RAT-SQL?
image

How about your training time per epoch ?

I reproduce the data preprocess ,and then train the model with electra-large-discriminator plm / msde local_and_nonlocal strategy.
I found it takes me around 50 min per epoch on a Tesla V100 32G with the same hyper-parameters on paper
Besides, I do some modify to use the DDP with 4 GPU, but the time only reduce to 40 min per epoch
Is the same for your training time ?
I want to do some experiment with the LGESQL basemodel, but the time counsuming is .....[SAD]

Question about the code of schema linking

Hi there! Thanks for sharing the code of your interesting paper!

image

In line 253:

q_tab_mat = np.array([['question-table-nomatch'] * t_num for _ in range(q_num)], dtype=dtype)

It built 'q_tab_mat' with size (q_num, t_num), t_num is the length of 'table_token' .

But in line 263:

q_tab_mat[range(i, j), idx] = 'question-table-exactmatch'

the 'idx' refers to the index of 'table_name' rather than of 'table_token'.

Could I ask why we should build q_tab_mat with the size of table_token but assign its value with the index of table_name?

download dependencies

When lgesql download dependencies :python -c "from embeddings import GloveEmbedding; emb = GloveEmbedding('common_crawl_48', d_emb=300)"
Traceback (most recent call last):
File "", line 1, in
File "D:\anaconda3\lib\site-packages\embeddings\glove.py", line 43, in init
self.db = self.initialize_db(self.path(path.join('glove', '{}:{}.db'.format(name, d_emb))))
File "D:\anaconda3\lib\site-packages\embeddings\embedding.py", line 22, in path
root = environ.get('EMBEDDINGS_ROOT', path.join(environ['HOME'], '.embeddings'))
File "D:\anaconda3\lib\os.py", line 675, in getitem
raise KeyError(key) from None
KeyError: 'HOME'

About Data Preprocessing

This is an amazing job. Therefore, I want to apply it to other dataset. I see that you use hyper parameter "skip-large". However, though my data just has 3 databases, the column number of each database is large. So can I continue to use this model? When I preprocessed my own dataset using process_graphs.py, it took too much time. Will my large database also lead to slow training?

code available?

Hello, I am interested in your work.
May I ask when your code will be available?
Best regards!

Google CoLab LGESQL

Have the authors or anyone in the community implemented this model in Google CoLab?

If so, a copy of the .ipynb would be much appreciated.

About the generation of "ON" clause

Hi there! Hope you are doing well. I ran your code and found that there isn't any "ON" clause in the generated SQL. I wonder if this is normal and if LGESQL can generate SQL with "ON" clause.

unable to preprocess data

I ran the command for preprocessing the train data in your run_preprocessing.sh:
python3 -u preprocess/process_dataset.py --dataset_path 'data/train.json' --raw_table_path 'data/tables.json' --table_path 'data/tables.bin' --output_path 'data/train.bin' --skip_large

but got error FileNotFoundError: [Errno 2] No such file or directory: 'data/tables.bin\r'.

Then I found this missing file in the processed dataset you provided. But isn't this tables.bin the output of preprocess phase?

vocab.txt for GloVe

There appear to be inconsistencies between the vocabulary contained within vocab.txt used for GloVe embeddings and the actual vocabulary of the Spider dataset. In terms of unique words, there is no correlation between vocab.txt and the amount of unique words seen in only questions, only queries and questions + queries combined from the Spider dataset.

image

Furthermore, when I order the contents of each by frequencies, vocab.txt does not appear to match frequencies of the Spider dataset either.

image

Since my investigations have yielded no conclusions, what is the meaning of vocab.txt? Where do the words and frequencies actually come from, if not the Spider dataset?

Note, I downloaded vocab.txt from the download link on the Code page: https://drive.google.com/file/d/1L8sWlp7J9LWjw9MP2bHGsf0wC4xLAyxO/view

Question about EXACT MATCH ACC

Hello, your work has made amazing progress on the spider data set, LGESQL + ELECTRA achieves 75.1 on the dev set, my question is whether this result is beam acc or sql acc?

How to add values generation ?

I am interested in your work and wanted to add the values to the generated SQL code. Unfortunately, despite several attempts I could not do it. I suspect it must be possible since the model seems to "understand" what the values are in the initial sentence. Is this possible and if so how?
Thank you!

Code Release Date

Hi @rhythmcao,

Your paper looks quite promising! Do you have a date in mind when you gonna release the code?

Thanks,
Ursin

Information about the hardware

computing infrastructure used for running experiments (hardware and software), including GPU/CPU models; the amount of memory

How to use multi-GPU training?

Hello,have a nice day!
I tried to use model=torch.nn.DataParallel(model).cuda() for multiple gpu training, but I got an Error: LinearDropConnect doesn't have the _weight attribute. Will you please help me solve this problem?
Thank you very much!

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.