distilbart cnn 12 6 text2sql

shahrukhx01

distilbart-cnn-12-6-text2sql

Introduction

The distilbart-cnn-12-6-text2sql model is a fine-tuned variant of BART, specifically designed for converting text queries into SQL queries. It has been trained on the WIKISQL dataset to facilitate the generation of SQL commands from natural language inputs.

Architecture

This model utilizes a distilled version of BART, which is a transformer-based model known for its efficiency and effectiveness in sequence-to-sequence tasks. It leverages the architecture of BART while being optimized for text-to-SQL tasks.

Training

The model has been fine-tuned on the WIKISQL dataset, a common dataset used for training models to understand and generate SQL queries from natural language inputs. This fine-tuning process enhances the model's ability to accurately convert text into SQL.

Guide: Running Locally

To run the distilbart-cnn-12-6-text2sql model locally, follow these steps:

  1. Install Transformers Library: Ensure you have the transformers library installed:

    pip install transformers
    
  2. Load the Model and Tokenizer:

    from transformers import BartTokenizer, BartForConditionalGeneration
    
    model = BartForConditionalGeneration.from_pretrained('shahrukhx01/distilbart-cnn-12-6-text2sql')
    tokenizer = BartTokenizer.from_pretrained('shahrukhx01/distilbart-cnn-12-6-text2sql')
    
  3. Prepare Input and Generate SQL:

    TEXT_QUERY = "what is the temperature of berlin "
    inputs = tokenizer([TEXT_QUERY], max_length=1024, return_tensors='pt')
    
    text_query_ids = model.generate(inputs['input_ids'], num_beams=4, max_length=5, early_stopping=True)
    print([tokenizer.decode(g, skip_special_tokens=True, clean_up_tokenization_spaces=False) for g in text_query_ids])
    
  4. Cloud GPU Suggestion: For efficient performance, especially with larger datasets or more complex queries, consider using cloud GPUs such as those available on Google Cloud, AWS, or Azure.

License

The licensing information for the distilbart-cnn-12-6-text2sql model is not specified in the provided content. Please refer to the model's repository or contact the author for licensing details.

More Related APIs in Text2text Generation