noom83 commited on
Commit
eea6d8c
·
verified ·
1 Parent(s): 14cc891

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +53 -14
README.md CHANGED
@@ -1,22 +1,61 @@
 
1
  ---
2
- base_model: unsloth/mistral-7b-instruct-v0.3-bnb-4bit
 
3
  tags:
4
- - text-generation-inference
5
- - transformers
6
- - unsloth
7
  - mistral
8
- - trl
9
- license: apache-2.0
10
- language:
11
- - en
 
12
  ---
13
 
14
- # Uploaded model
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
 
16
- - **Developed by:** exaler
17
- - **License:** apache-2.0
18
- - **Finetuned from model :** unsloth/mistral-7b-instruct-v0.3-bnb-4bit
19
 
20
- This mistral model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
21
 
22
- [<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
 
 
1
+
2
  ---
3
+ language: en
4
+ license: apache-2.0
5
  tags:
 
 
 
6
  - mistral
7
+ - sql
8
+ - lora
9
+ - instruction-tuning
10
+ datasets:
11
+ - custom_sql_dataset
12
  ---
13
 
14
+ # SQL Query Generation Model
15
+
16
+ This model is a fine-tuned version of mistralai/Mistral-7B-Instruct-v0.3 specialized for SQL query generation.
17
+
18
+ ## Model Details
19
+
20
+ - **Base Model**: mistralai/Mistral-7B-Instruct-v0.3
21
+ - **Training Method**: LoRA (Rank=16, Alpha=32)
22
+ - **Task**: SQL query generation from natural language instructions
23
+ - **Training Framework**: Unsloth
24
+
25
+ ## Usage
26
+
27
+ ```python
28
+ from transformers import AutoModelForCausalLM, AutoTokenizer
29
+ from peft import PeftModel
30
+
31
+ # Load the model
32
+ tokenizer = AutoTokenizer.from_pretrained("exaler/aaa-2-sql-2")
33
+ model = AutoModelForCausalLM.from_pretrained("exaler/aaa-2-sql-2")
34
+
35
+ # Format your prompt
36
+ instruction = """You are an expert SQL query generator. Database schema:
37
+ Table: [dbo].[Users]
38
+ Columns: [ID], [Name], [Email], [CreatedDate]
39
+ Table: [dbo].[Orders]
40
+ Columns: [OrderID], [UserID], [Amount], [Status], [OrderDate]
41
+ """
42
+
43
+ input_text = "Find all users who placed orders with amount greater than 1000"
44
+
45
+ prompt = f"<s>[INST] {instruction}\n\n{input_text} [/INST]"
46
+
47
+ # Generate SQL
48
+ inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
49
+ outputs = model.generate(inputs=inputs.input_ids, max_new_tokens=512, temperature=0.0)
50
+ response = tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True)
51
+ print(response)
52
+ ```
53
+
54
+ ## Training Dataset
55
 
56
+ The model was trained on a custom dataset of SQL queries with their corresponding natural language descriptions.
 
 
57
 
58
+ ## Limitations
59
 
60
+ - The model is optimized for the specific SQL database schema it was trained on
61
+ - Performance may vary for database schemas significantly different from the training data