shahrukhx01 commited on
Commit
b058738
1 Parent(s): 225bc19

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +14 -0
README.md ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ```python
2
+ from transformers import BartTokenizer, BartForConditionalGeneration, BartConfig
3
+ model = BartForConditionalGeneration.from_pretrained('shahrukhx01/schema-aware-denoising-bart-large-cnn')
4
+ tokenizer = BartTokenizer.from_pretrained('shahrukhx01/schema-aware-denoising-bart-large-cnn')
5
+ ## add NL query with table schema
6
+ question = "What is terrence ross' nationality? </s> <col0> Player : text <col1> No. : text <col2> Nationality : text <col3> Position : text <col4> Years in Toronto : text <col5> School/Club Team : text"
7
+
8
+ inputs = tokenizer([question], max_length=1024, return_tensors='pt')
9
+
10
+ # Generate SQL
11
+ text_query_ids = model.generate(inputs['input_ids'], num_beams=4, min_length=0, max_length=125, early_stopping=True)
12
+ prediction = [tokenizer.decode(g, skip_special_tokens=True, clean_up_tokenization_spaces=False) for g in text_query_ids][0]
13
+ print(prediction)
14
+ ```