Instructions to use dsivakumar/text2sql with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use dsivakumar/text2sql with Transformers:
# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("dsivakumar/text2sql") model = AutoModelForSeq2SeqLM.from_pretrained("dsivakumar/text2sql") - Notebooks
- Google Colab
- Kaggle
Commit ·
9b3347b
1
Parent(s): 620c22d
Update README.md
Browse files
README.md
CHANGED
|
@@ -44,4 +44,18 @@ def get_sql(query,tokenizer,model):
|
|
| 44 |
query="Show me the average age of of wines in Italy by provinces"
|
| 45 |
sql = get_sql(query,tokenizer,model)
|
| 46 |
print(sql)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
```
|
|
|
|
| 44 |
query="Show me the average age of of wines in Italy by provinces"
|
| 45 |
sql = get_sql(query,tokenizer,model)
|
| 46 |
print(sql)
|
| 47 |
+
|
| 48 |
+
#https://huggingface.co/mrm8488/t5-small-finetuned-wikiSQL
|
| 49 |
+
def get_sql(query):
|
| 50 |
+
input_text = "translate English to SQL: %s </s>" % query
|
| 51 |
+
features = tokenizer([input_text], return_tensors='pt')
|
| 52 |
+
|
| 53 |
+
output = model.generate(input_ids=features['input_ids'],
|
| 54 |
+
attention_mask=features['attention_mask'])
|
| 55 |
+
|
| 56 |
+
return tokenizer.decode(output[0])
|
| 57 |
+
|
| 58 |
+
query = "How many models were finetuned using BERT as base model?"
|
| 59 |
+
|
| 60 |
+
get_sql(query)
|
| 61 |
```
|