Create README.md
Browse files# How to Use
```
import torch
from transformers import T5ForConditionalGeneration, AutoTokenizer
device = torch.device("cuda:0")
tokenizer = AutoTokenizer.from_pretrained("LarkAI/codet5p-770m_nl2sql_oig")
model = T5ForConditionalGeneration.from_pretrained("LarkAI/codet5p-770m_nl2sql_oig").to(device)
text = "Given the following schema:\nroad (road_name, state_name)\nstate (state_name, capital, population, area, country_name, density)\nhighlow (state_name, highest_point, highest_elevation, lowest_point, lowest_elevation)\nlake (lake_name, area, state_name, country_name)\nriver (river_name, length, traverse, country_name)\nborder_info (state_name, border)\nmountain (mountain_name, mountain_altitude, state_name, country_name)\ncity (city_name, state_name, population, country_name)\nWrite a SQL query to what states does the mississippi river run throug"
inputs = tokenizer.encode(text, return_tensors="pt").to(device)
output_ids = model.generate(inputs, max_length=512)
response_text = self.tokenizer.decode(outputs[0], skip_special_tokens=True)
# SELECT traverse FROM river WHERE river_name = \"mississippi\" ;
```