Commit
·
e987fab
1
Parent(s):
922603b
Update README.md
Browse files
README.md
CHANGED
|
@@ -11,7 +11,7 @@ tags:
|
|
| 11 |
|
| 12 |
# How to Use
|
| 13 |
|
| 14 |
-
```
|
| 15 |
import torch
|
| 16 |
from transformers import T5ForConditionalGeneration, AutoTokenizer
|
| 17 |
|
|
@@ -20,9 +20,9 @@ device = torch.device("cuda:0")
|
|
| 20 |
tokenizer = AutoTokenizer.from_pretrained("LarkAI/codet5p-770m_nl2sql_oig")
|
| 21 |
model = T5ForConditionalGeneration.from_pretrained("LarkAI/codet5p-770m_nl2sql_oig").to(device)
|
| 22 |
|
| 23 |
-
text = "Given the following schema:\
|
| 24 |
inputs = tokenizer.encode(text, return_tensors="pt").to(device)
|
| 25 |
output_ids = model.generate(inputs, max_length=512)
|
| 26 |
response_text = self.tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 27 |
-
# SELECT
|
| 28 |
```
|
|
|
|
| 11 |
|
| 12 |
# How to Use
|
| 13 |
|
| 14 |
+
```python
|
| 15 |
import torch
|
| 16 |
from transformers import T5ForConditionalGeneration, AutoTokenizer
|
| 17 |
|
|
|
|
| 20 |
tokenizer = AutoTokenizer.from_pretrained("LarkAI/codet5p-770m_nl2sql_oig")
|
| 21 |
model = T5ForConditionalGeneration.from_pretrained("LarkAI/codet5p-770m_nl2sql_oig").to(device)
|
| 22 |
|
| 23 |
+
text = "Given the following schema:\ntrack (Track_ID, Name, Location, Seating, Year_Opened)\nrace (Race_ID, Name, Class, Date, Track_ID)\nWrite a SQL query to count the number of tracks."
|
| 24 |
inputs = tokenizer.encode(text, return_tensors="pt").to(device)
|
| 25 |
output_ids = model.generate(inputs, max_length=512)
|
| 26 |
response_text = self.tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 27 |
+
# SELECT COUNT( * ) FROM track
|
| 28 |
```
|