• Stars
    star
    147
  • Rank 251,347 (Top 5 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created over 3 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

[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".

LGESQL

This is the project containing source code for the paper LGESQL: Line Graph Enhanced Text-to-SQL Model with Mixed Local and Non-Local Relations in ACL 2021 main conference. If you find it useful, please cite our work.

    @inproceedings{cao-etal-2021-lgesql,
            title = "{LGESQL}: Line Graph Enhanced Text-to-{SQL} Model with Mixed Local and Non-Local Relations",
            author = "Cao, Ruisheng  and
            Chen, Lu  and
            Chen, Zhi  and
            Zhao, Yanbin  and
            Zhu, Su  and
            Yu, Kai",
            booktitle = "Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers)",
            month = aug,
            year = "2021",
            address = "Online",
            publisher = "Association for Computational Linguistics",
            url = "https://aclanthology.org/2021.acl-long.198",
            doi = "10.18653/v1/2021.acl-long.198",
            pages = "2541--2555",
    }

Create environment and download dependencies

The following commands are provided in setup.sh.

  1. Firstly, create conda environment text2sql:
  • In our experiments, we use torch==1.6.0 and dgl==0.5.3 with CUDA version 10.1

  • We use one GeForce RTX 2080 Ti for GLOVE and base-series pre-trained language model~(PLM) experiments, one Tesla V100-PCIE-32GB for large-series PLM experiments

    conda create -n text2sql python=3.6
    source activate text2sql
    pip install torch==1.6.0+cu101 -f https://download.pytorch.org/whl/torch_stable.html
    pip install -r requirements.txt
    
  1. Next, download dependencies:

     python -c "import stanza; stanza.download('en')"
     python -c "from embeddings import GloveEmbedding; emb = GloveEmbedding('common_crawl_48', d_emb=300)"
     python -c "import nltk; nltk.download('stopwords')"
    
  2. Download pre-trained language models from Hugging Face Model Hub, such as bert-large-whole-word-masking and electra-large-discriminator, into the pretrained_models directory. The vocab file for glove.42B.300d is also pulled: (please ensure that Git LFS is installed)

     mkdir -p pretrained_models && cd pretrained_models
     git lfs install
     git clone https://huggingface.co/bert-large-uncased-whole-word-masking
     git clone https://huggingface.co/google/electra-large-discriminator
     mkdir -p glove.42b.300d && cd glove.42b.300d
     wget -c http://nlp.stanford.edu/data/glove.42B.300d.zip && unzip glove.42B.300d.zip
     awk -v FS=' ' '{print $1}' glove.42B.300d.txt > vocab_glove.txt
    

Download and preprocess dataset

  1. Download, unzip and rename the spider.zip into the directory data.

  2. Merge the data/train_spider.json and data/train_others.json into one single dataset data/train.json.

  3. Preprocess the train and dev dataset, including input normalization, schema linking, graph construction and output actions generation. (Our preprocessed dataset can be downloaded here)

     ./run/run_preprocessing.sh
    

Training

Training LGESQL models with GLOVE, BERT and ELECTRA respectively:

  • msde: mixed static and dynamic embeddings

  • mmc: multi-head multi-view concatenation

    ./run/run_lgesql_glove.sh [mmc|msde]
    ./run/run_lgesql_plm.sh [mmc|msde] bert-large-uncased-whole-word-masking
    ./run/run_lgesql_plm.sh [mmc|msde] electra-large-discriminator
    

Evaluation and submission

  1. Create the directory saved_models, save the trained model and its configuration (at least containing model.bin and params.json) into a new directory under saved_models, e.g. saved_models/electra-msde-75.1/.

  2. For evaluation, see run/run_evaluation.sh and run/run_submission.sh (eval from scratch) for reference.

  3. Model instances and submission scripts are available in codalab:plm and google drive: including submitted BERT and ELECTRA models. Codes and model for GLOVE are deprecated.

Results

Dev and test EXACT MATCH ACC in the official leaderboard, also provided in the results directory:

model dev acc test acc
LGESQL + GLOVE 67.6 62.8
LGESQL + BERT 74.1 68.3
LGESQL + ELECTRA 75.1 72.0

Acknowledgements

We would like to thank Tao Yu, Yusen Zhang and Bo Pang for running evaluations on our submitted models. We are also grateful to the flexible semantic parser TranX that inspires our works.

More Repositories

1

AniTalker

[ACM MM 2024] This is the official code for "AniTalker: Animate Vivid and Diverse Talking Faces through Identity-Decoupled Facial Motion Encoding"
Jupyter Notebook
1,335
star
2

SLAM-LLM

Speech, Language, Audio, Music Processing with Large Language Model
Python
553
star
3

VoiceFlow-TTS

[ICASSP 2024] This is the official code for "VoiceFlow: Efficient Text-to-Speech with Rectified Flow Matching"
Python
302
star
4

UniCATS-CTX-vec2wav

[AAAI 2024] Code for CTX-vec2wav in UniCATS
Python
119
star
5

UniCATS-CTX-txt2vec

[AAAI 2024] CTX-txt2vec, the acoustic model in UniCATS
Python
61
star
6

WebSRC-Baseline

The baseline code for WebSRC dataset.
HTML
37
star
7

Mobile-Env

A Universal Platform for Training and Evaluation of Mobile Interaction
Python
29
star
8

StoryTTS

https://goarsenal.github.io/StoryTTS/
HTML
20
star
9

BER

Balanced Error Rate for Speaker Diarization
Python
18
star
10

MSDWILD

This dataset is designed for multi-modal speaker diarization and lip-speech synchronization in the wild.
HTML
16
star
11

text2sql-GPT

[EMNLP 2023 Findings] ACT-SQL: In-Context Learning for Text-to-SQL with Automatically-Generated Chain-of-Thought
Python
16
star
12

public_talks

Materials of public talks given By SJTU X-LANCE members
14
star
13

suzhou-tutorials

A brief tutorial and startup scripts about suzhou clusters for members of speechlab
Shell
13
star
14

PaperReading

整理各研究方向经典论文
10
star
15

META-GUI-baseline

[EMNLP 2022] The baseline code for META-GUI dataset
Python
10
star
16

TIE

Python
9
star
17

text2sql-multiturn-GPT

[NAACL 2024] CoE-SQL: In-Context Learning for Multi-Turn Text-to-SQL with Chain-of-Editions
Python
6
star
18

medical-dataset

[ACL 2023 Findings] CSS: A Large-scale Cross-schema Chinese Text-to-SQL Medical Dataset
Python
5
star
19

AttrEnhZsAc

Python
4
star
20

WebSRC

WebSRC: A dataset for web based structural machine reading comprehension.
CSS
2
star
21

D4

[EMNLP 2022] D4: a Chinese Dialogue Dataset for Depression-Diagnosis-Oriented Chat
CSS
1
star