File size: 2,151 Bytes
3726403 29bb15c 13ac548 29bb15c 13ac548 72f2e5f 7fae44a 3726403 f2c61ec 3726403 4a14c32 634c63e 4a14c32 4ac9a65 172dfb2 4a14c32 486ff5a 4a14c32 6f09249 4a14c32 5fc5214 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
---
language: en
widget:
- text: "translate English to SQL: Tell me a feel good story over last day"
example_title: Last day 1
- text: "translate English to SQL: feel good story since yesterday"
example_title: Last day 2
- text: "translate English to SQL: Show me sports stories since yesterday with team equal Red Sox"
example_title: Last day with filter
- text: "translate English to SQL: Breaking news summarized"
example_title: Summary
- text: "translate English to SQL: Breaking news translated to fr"
example_title: Translate to French
inference:
parameters:
max_length: 512
license: apache-2.0
library_name: txtai
---
# T5-small finedtuned to generate txtai SQL
[T5 small](https://huggingface.co/t5-small) fine-tuned to generate [txtai](https://github.com/neuml/txtai) SQL. This model takes natural language queries and builds txtai-compatible SQL statements.
txtai supports both natural language queries
```
Tell me a feel good story
Show me stories about wildlife
Sports stories about hockey
```
and SQL statements
```
select * from txtai where similar("Tell me a feel good story") and
entry >= date('now', '-1 day')
```
This model bridges the gap between the two and enables natural language queries with filters.
```
Tell me a feel good story since yesterday
Show me sports stories since yesterday with team equal Red Sox
Breaking news summarized
Breaking news translated to fr
```
## Custom query syntax
This model is an example of creating a custom query syntax that can be translated into SQL txtai can understand. Any query syntax can be created. This one supports English but a similar strategy can be deployed to support other languages. Natural language can be translated to functions, query clauses, column selection and more.
See [t5-small-bashsql](https://huggingface.co/NeuML/t5-small-bashsql) for a model that translates Bash like commands into txtai SQL.
## Model training
This model was trained using scripts that can be [found here](https://github.com/neuml/txtai/tree/master/models/txtsql).
Steps to train:
```bash
python generate.py txtsql.csv
python train.py txtsql.csv t5-small-txtsql
```
|