Update README.md
Browse files
README.md
CHANGED
|
@@ -1,26 +1,26 @@
|
|
| 1 |
# t5_wikisql_SQL2en
|
| 2 |
|
| 3 |
-
This is
|
| 4 |
|
| 5 |
The model can be loaded like so:
|
| 6 |
|
| 7 |
```python
|
| 8 |
-
from transformers import
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
model = AutoModelWithLMHead.from_pretrained("/content/model")
|
| 12 |
```
|
| 13 |
|
| 14 |
You can then use this model to translate SQL queries into plain english.
|
| 15 |
|
| 16 |
```python
|
|
|
|
| 17 |
input_text = f"translate English to SQL: {query} </s>"
|
| 18 |
features = tokenizer([input_text], return_tensors='pt')
|
| 19 |
|
| 20 |
-
output = model.generate(input_ids=features['input_ids'],
|
| 21 |
-
attention_mask=features['attention_mask'])
|
| 22 |
|
| 23 |
tokenizer.decode(output[0])
|
| 24 |
```
|
| 25 |
|
| 26 |
-
The whole training process and hyperparameters are in my [
|
|
|
|
| 1 |
# t5_wikisql_SQL2en
|
| 2 |
|
| 3 |
+
This is t5_wikisql_SQL2en , a t5-small fine-tuned version on the wikisql dataset.
|
| 4 |
|
| 5 |
The model can be loaded like so:
|
| 6 |
|
| 7 |
```python
|
| 8 |
+
from transformers import AutoTokenizer, AutoModelWithLMHead
|
| 9 |
+
tokenizer = AutoTokenizer.from_pretrained("dbernsohn/t5_wikisql_SQL2en")
|
| 10 |
+
model = AutoModelWithLMHead.from_pretrained("dbernsohn/t5_wikisql_SQL2en")
|
|
|
|
| 11 |
```
|
| 12 |
|
| 13 |
You can then use this model to translate SQL queries into plain english.
|
| 14 |
|
| 15 |
```python
|
| 16 |
+
query = "SELECT COUNT Params from model where location=HF-Hub"
|
| 17 |
input_text = f"translate English to SQL: {query} </s>"
|
| 18 |
features = tokenizer([input_text], return_tensors='pt')
|
| 19 |
|
| 20 |
+
output = model.generate(input_ids=features['input_ids'].cuda(),
|
| 21 |
+
attention_mask=features['attention_mask'].cuda())
|
| 22 |
|
| 23 |
tokenizer.decode(output[0])
|
| 24 |
```
|
| 25 |
|
| 26 |
+
The whole training process and hyperparameters are in my [GitHub repo] (https://github.com/DorBernsohn)
|