File size: 1,793 Bytes
311a5fa
0c1cc58
 
 
 
 
 
 
 
 
 
 
 
 
311a5fa
16a4296
311a5fa
0c1cc58
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
language: en
widget:
- text: "translate Bash to SQL: find -name \"feel good story\" -mtime -1"
  example_title: Last day
- text: "translate Bash to SQL: find -name \"show me sports stories\" -mtime -1 -team \"Red Sox\""
  example_title: Last day with filter
- text: "translate Bash to SQL: find -name \"breaking news\" -summary"
  example_title: Summary
- text: "translate Bash to SQL: find -name \"breaking news\" -translate 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 [Bash](https://en.wikipedia.org/wiki/Bash_(Unix_shell)) like commands and builds txtai-compatible SQL statements.

```
find -name "feel good story" -mtime -1
find -name "show me sports stories" -mtime -1 -team \"Red Sox\"
find -name "breaking news" -summary
find -name "breaking news" -translate 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 Bash-like commands 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-txtsql](https://huggingface.co/NeuML/t5-small-txtsql) for a model that translates natural language statements into txtai SQL.

## Model training

This model was trained using scripts that can be [found here](https://github.com/neuml/txtai/tree/master/models/bashsql).

Steps to train:

```bash
python generate.py bashsql.csv
python train.py bashsql.csv t5-small-bashsql
```