Caleb Bartholomew commited on
Commit
42dd54d
1 Parent(s): 75391ba

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +27 -1
README.md CHANGED
@@ -2,4 +2,30 @@
2
  language:
3
  - en
4
  library_name: transformers
5
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  language:
3
  - en
4
  library_name: transformers
5
+ ---
6
+
7
+ Toy model finetuned on the `b-mc2/sql-create-context` dataset.
8
+
9
+ ## Sample Code
10
+
11
+ ```python
12
+ import torch
13
+ from transformers import AutoModelForCausalLM, AutoTokenizer
14
+
15
+ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
16
+
17
+ model = AutoModelForCausalLM.from_pretrained("Artifact-io/toy-sql-28M").to(device)
18
+ tokenizer = AutoTokenizer.from_pretrained("Artifact-io/toy-sql-28M")
19
+
20
+ inputs = tokenizer([
21
+ """CREATE TABLE head (age INTEGER)
22
+ How many heads of the departments are older than 56?
23
+ """
24
+ ],
25
+ return_tensors="pt",
26
+ ).to(device)
27
+
28
+ outputs = model.generate(**inputs, max_new_tokens=200, do_sample=True, top_k=50, top_p=0.95)
29
+ text = tokenizer.batch_decode(outputs[:, inputs.input_ids.shape[1]:], skip_special_tokens=True)[0].split("---")[0]
30
+ print(text)
31
+ ```