Ary-007 commited on
Commit
012fa32
·
verified ·
1 Parent(s): 9e609dc

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +53 -10
README.md CHANGED
@@ -19,9 +19,9 @@ This model is a fine-tuned version of Llama-3.2-3B-Instruct designed specificall
19
  It is lightweight (3B parameters), making it suitable for local deployment on consumer GPUs using 4-bit quantization.
20
 
21
  ### Model Description
22
- Base Model: unsloth/Llama-3.2-3B-Instruct
23
- Fine-tuning Framework: Unsloth (QLoRA)
24
- Dataset: gretelai/synthetic_text_to_sql
25
 
26
 
27
  ## Uses
@@ -32,11 +32,54 @@ The model was trained using the Alpaca prompt format. For best results, structur
32
  ![image](https://cdn-uploads.huggingface.co/production/uploads/656b8d33e8bf55919a6aa345/1XEAfrZ5iU7doBDy_T5ef.png)
33
 
34
  ## How to Get Started with the Model
35
-
36
-
37
-
38
-
39
- #### Summary
40
-
41
- ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
 
 
19
  It is lightweight (3B parameters), making it suitable for local deployment on consumer GPUs using 4-bit quantization.
20
 
21
  ### Model Description
22
+ 1) Base Model: unsloth/Llama-3.2-3B-Instruct
23
+ 2) Fine-tuning Framework: Unsloth (QLoRA)
24
+ 3) Dataset: gretelai/synthetic_text_to_sql
25
 
26
 
27
  ## Uses
 
32
  ![image](https://cdn-uploads.huggingface.co/production/uploads/656b8d33e8bf55919a6aa345/1XEAfrZ5iU7doBDy_T5ef.png)
33
 
34
  ## How to Get Started with the Model
35
+ '''python
36
+
37
+ import torch
38
+ from transformers import pipeline
39
+
40
+ model_id = "Ary-007/Text-to-sql-llama-3.2"
41
+
42
+ # Load the pipeline
43
+ pipe = pipeline(
44
+ "text-generation",
45
+ model=model_id,
46
+ device_map="auto",
47
+ )
48
+
49
+ # Define the schema (Context)
50
+ schema = """
51
+ CREATE TABLE employees (
52
+ id INT,
53
+ name TEXT,
54
+ department TEXT,
55
+ salary INT,
56
+ hire_date DATE
57
+ );
58
+ """
59
+
60
+ # Define the user question
61
+ question = "Find the name and salary of employees in the 'Engineering' department who earn more than 80000."
62
+
63
+ # Format the prompt exactly as trained
64
+ prompt = f"""Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
65
+
66
+ ### Instruction:
67
+ Company Database : {schema}
68
+
69
+ ### Input:
70
+ SQL Prompt :{question}
71
+
72
+ ### Response:
73
+ """
74
+
75
+ outputs = pipe(
76
+ prompt,
77
+ max_new_tokens=200,
78
+ do_sample=True,
79
+ temperature=0.1,
80
+ top_p=0.9
81
+ )
82
+
83
+ print(outputs[0]["generated_text"])
84
+ '''
85