Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
# Phi-3 Text-to-SQL Model
|
3 |
+
|
4 |
+
This is a fine-tuned **Microsoft Phi-3** model specialized for **Text-to-SQL** generation.
|
5 |
+
|
6 |
+
## Example
|
7 |
+
|
8 |
+
```python
|
9 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
10 |
+
|
11 |
+
repo_id = "bhavika24/text2sql"
|
12 |
+
tokenizer = AutoTokenizer.from_pretrained(repo_id)
|
13 |
+
model = AutoModelForCausalLM.from_pretrained(repo_id, torch_dtype="auto", device_map="auto")
|
14 |
+
|
15 |
+
question = "List all customers who ordered products over $500 last month."
|
16 |
+
inputs = tokenizer(question, return_tensors="pt").to(model.device)
|
17 |
+
outputs = model.generate(**inputs, max_new_tokens=128)
|
18 |
+
|
19 |
+
sql_query = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
20 |
+
print(sql_query)
|