ataberkd commited on
Commit
24dbd83
1 Parent(s): f5b4b45

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +38 -0
README.md ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ datasets:
4
+ - kaxap/llama2-sql-instruct-sys-prompt
5
+ pipeline_tag: text-generation
6
+ ---
7
+
8
+ ## 💻 Usage
9
+
10
+ ``` python
11
+ # pip install transformers accelerate
12
+
13
+ from transformers import AutoTokenizer
14
+ import transformers
15
+ import torch
16
+
17
+ model = "ataberkd/llama-2-7b-SQL_FINETUNED_10K"
18
+ prompt = 'You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question and give the explanation of result your giving. CREATE TABLE statement: CREATE TABLE "user" ( "name" text, "surname" text, "tel" text, "address" text, "performanceScore" text,"Age" text, "Language" text );. Question: "Can you bring users who speak French and are greater than 20 years old?"'
19
+
20
+ tokenizer = AutoTokenizer.from_pretrained(model)
21
+ pipeline = transformers.pipeline(
22
+ "text-generation",
23
+ model=model,
24
+ torch_dtype=torch.float16,
25
+ device_map="auto",
26
+ )
27
+
28
+ sequences = pipeline(
29
+ f'<s>[INST] {prompt} [/INST]',
30
+ do_sample=True,
31
+ top_k=10,
32
+ num_return_sequences=1,
33
+ eos_token_id=tokenizer.eos_token_id,
34
+ max_length=200,
35
+ )
36
+ for seq in sequences:
37
+ print(f"Result: {seq['generated_text']}")
38
+ ```