Git Product home page Git Product logo

tset's Introduction

TSET

Implementations for paper "Enhancing SPARQL Query Generation for KBQA Systems by Learning to Correct Triplets".

Environment setup

Create an environment using Python 3.7, and install the dependencies with

pip install -r requirements.txt

Dataset preparation

Use pre-processed datasets

The pre-processed datasets that can be used directly for training has been placed under the folder transform/transformers_cache/downloads. And we recommend you to use them.

  • LC-QuAD2.0-master: Processed LC-QuAD 2.0 dataset for fine-tuning;
  • LC-QuAD2.0-pre: Processed LC-QuAD 2.0 dataset for pre-training;
  • QALD_9_PULS: Processed Qald-9-plus dataset for fine-tuning;
  • QALD_10: Processed Qald-10 dataset for fine-tuning.

Do yourself

You can also download the original datasets and process them yourself.

The preprocessing scripts are under the folder preprocess/LC-QuAD2.0-pre.

Pre-training

The configs/train_1.json is an example of parameter configuration for pre-training.

Replace "model_name_or_path" with the model name (t5-small, t5-base, or t5-large) or the path to your checkpoint , "output_dir" with where you want to store your outputs, and "cache_dir" with the place for caching.

You can simply run the code below:

CUDA_VISIBLE_DEVICES=0 python seq2seq/run_seq2seq.py configs/train_1.json

Fine-tuning

The configs/train_2.json is an example of parameter configuration for fine-tuning the model.

You should replace "dataset" with the name of the dataset that your want to fine-tune the model on, and you can choose from [lc_quad_2, qald_9, qald_10]. Replace "model_name_or_path" with the path to your checkpoint obtained during the previous pre-training.

You can simply run the code below:

CUDA_VISIBLE_DEVICES=0 python seq2seq/run_seq2seq.py configs/train_2.json

tset's People

Contributors

shadowbringer1 avatar jiexingqi avatar

Stargazers

Aleksandr Perevalov avatar Xiangyan Chen avatar  avatar

Watchers

 avatar

tset's Issues

About the Prediction

Hi! I'm very interested in this work. I pre-trained and fine-tuned this project, and everything ran well. However, when I wanted to infer, I felt confused. I saw a file named "prediction_output.py" and didn't know how to run it. Could you give more explanations or examples on prediction? If I have a natural language query, how do I predict it?

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.