ThotaBhanu commited on
Commit
6a60e1c
·
verified ·
1 Parent(s): b578a97

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +76 -49
README.md CHANGED
@@ -1,100 +1,120 @@
1
  ---
2
  library_name: transformers
3
- tags: []
4
  ---
5
 
6
- # Model Card for Model ID
7
-
8
- <!-- Provide a quick summary of what the model is/does. -->
9
-
10
-
11
 
12
  ## Model Details
13
 
14
  ### Model Description
15
 
16
- <!-- Provide a longer summary of what this model is. -->
17
 
18
- This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
 
 
 
 
 
 
19
 
20
- - **Developed by:** Bhanu Prasad Thota
21
- - **Funded by [optional]:** [More Information Needed]
22
- - **Shared by [optional]:** [More Information Needed]
23
- - **Model type:** T5-based Natural Language to SQL Model
24
- - **Language(s) (NLP):** English
25
- - **License:** MIT
26
- - **Finetuned from model [optional]:** `t5-large`
27
 
28
- This model is trained to convert natural language queries into SQL statements using the **WikiSQL dataset**.
29
 
30
- ### Model Sources [optional]
31
 
32
- <!-- Provide the basic links for the model. -->
 
 
33
 
34
- - **Repository:** [More Information Needed]
35
- - **Paper [optional]:** [More Information Needed]
36
- - **Demo [optional]:** [More Information Needed]
37
 
38
  ## Uses
39
 
40
- <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
41
-
42
  ### Direct Use
43
 
44
- <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
45
-
46
- [More Information Needed]
47
-
48
- ### Downstream Use [optional]
49
 
50
- <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
51
 
52
- [More Information Needed]
 
53
 
54
  ### Out-of-Scope Use
55
 
56
- <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
 
 
57
 
58
- [More Information Needed]
59
 
60
  ## Bias, Risks, and Limitations
61
 
62
- <!-- This section is meant to convey both technical and sociotechnical limitations. -->
63
-
64
- [More Information Needed]
65
 
66
  ### Recommendations
67
 
68
- <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
 
 
69
 
70
- Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
71
 
72
  ## How to Get Started with the Model
73
 
74
- Use the code below to get started with the model.
75
 
76
- [More Information Needed]
 
77
 
78
- ## Training Details
 
 
 
79
 
80
- ### Training Data
 
 
 
 
 
81
 
82
- <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
 
 
83
 
84
- [More Information Needed]
 
85
 
86
- ### Training Procedure
87
 
88
- <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
89
 
90
- #### Preprocessing [optional]
 
 
 
 
91
 
92
- [More Information Needed]
93
 
 
 
 
 
 
 
 
 
94
 
95
  #### Training Hyperparameters
96
 
97
- - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
 
98
 
99
  #### Speeds, Sizes, Times [optional]
100
 
@@ -172,7 +192,14 @@ Carbon emissions can be estimated using the [Machine Learning Impact calculator]
172
 
173
  ## Citation [optional]
174
 
175
- <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
 
 
 
 
 
 
 
176
 
177
  **BibTeX:**
178
 
 
1
  ---
2
  library_name: transformers
3
+ tags: [text2sql, sql-generation, t5, natural-language-processing]
4
  ---
5
 
6
+ # Model Card for ThotaBhanu/t5_sql_askdb
 
 
 
 
7
 
8
  ## Model Details
9
 
10
  ### Model Description
11
 
12
+ This model is a **T5-based Natural Language to SQL** converter, fine-tuned on the **WikiSQL dataset**. It is designed to convert **English natural language queries** into **SQL queries** that can be executed on relational databases.
13
 
14
+ - **Developed by:** Bhanu Prasad Thota
15
+ - **Funded by [optional]:** Independent
16
+ - **Shared by [optional]:** Bhanu Prasad Thota
17
+ - **Model type:** T5-based Sequence-to-Sequence Model
18
+ - **Language(s):** English
19
+ - **License:** MIT
20
+ - **Finetuned from model:** `t5-large`
21
 
22
+ This model is particularly useful for **text-to-SQL applications**, allowing users to **query databases using plain English** instead of writing SQL.
 
 
 
 
 
 
23
 
24
+ ---
25
 
26
+ ## Model Sources
27
 
28
+ - **Repository:** [https://huggingface.co/ThotaBhanu/t5_sql_askdb](https://huggingface.co/ThotaBhanu/t5_sql_askdb)
29
+ - **Paper [optional]:** N/A
30
+ - **Demo [optional]:** Coming soon
31
 
32
+ ---
 
 
33
 
34
  ## Uses
35
 
 
 
36
  ### Direct Use
37
 
38
+ - Convert **natural language questions** into **SQL queries**
39
+ - Assist in **database query automation**
40
+ - Can be used in **chatbots, data analytics tools, and enterprise database search systems**
 
 
41
 
42
+ ### Downstream Use
43
 
44
+ - Can be **fine-tuned** further on **custom datasets** to improve domain-specific SQL generation
45
+ - Can be integrated into **business intelligence tools** for better user interaction
46
 
47
  ### Out-of-Scope Use
48
 
49
+ - The model does **not infer database schema** automatically
50
+ - May generate incorrect SQL for **complex nested queries or multi-table joins**
51
+ - Not suitable for **non-relational (NoSQL) databases**
52
 
53
+ ---
54
 
55
  ## Bias, Risks, and Limitations
56
 
57
+ - The model may not **always generate valid SQL** for **custom database schemas**
58
+ - Assumes **consistent column naming**, which may not always be the case in enterprise databases
59
+ - Performance depends on **how well the input query aligns** with the training data format
60
 
61
  ### Recommendations
62
 
63
+ - Always **validate generated SQL** before executing on a live database
64
+ - Use **schema-aware** validation methods for production environments
65
+ - Consider **fine-tuning the model** on domain-specific SQL queries
66
 
67
+ ---
68
 
69
  ## How to Get Started with the Model
70
 
71
+ Use the code below to generate SQL queries from natural language:
72
 
73
+ ```python
74
+ from transformers import T5Tokenizer, T5ForConditionalGeneration
75
 
76
+ # Load model and tokenizer
77
+ model_name = "ThotaBhanu/t5_sql_askdb"
78
+ tokenizer = T5Tokenizer.from_pretrained(model_name)
79
+ model = T5ForConditionalGeneration.from_pretrained(model_name)
80
 
81
+ # Function to convert query to SQL
82
+ def generate_sql(query):
83
+ input_text = f"Convert to SQL: {query}"
84
+ inputs = tokenizer(input_text, return_tensors="pt")
85
+ output = model.generate(**inputs)
86
+ return tokenizer.decode(output[0], skip_special_tokens=True)
87
 
88
+ # Example usage
89
+ query = "Find all employees who joined in 2020"
90
+ sql_query = generate_sql(query)
91
 
92
+ print(f"📝 Query: {query}")
93
+ print(f"🛠 Generated SQL: {sql_query}")
94
 
 
95
 
96
+ ## Training Details
97
 
98
+ ### Training Data
99
+
100
+ Dataset: WikiSQL
101
+ Size: 80,654 pairs of natural language questions and SQL queries
102
+ Preprocessing: Tokenization using T5Tokenizer, max length 128
103
 
 
104
 
105
+ ### Training Procedure
106
+
107
+ Training framework: Hugging Face Transformers + PyTorch
108
+ Hardware used: NVIDIA V100 GPU
109
+ Optimizer: AdamW
110
+ Learning rate: 5e-5
111
+ Batch size: 8
112
+ Epochs: 5
113
 
114
  #### Training Hyperparameters
115
 
116
+ Training precision: Mixed precision (fp16)
117
+ Gradient accumulation: Yes (to handle large batch sizes)
118
 
119
  #### Speeds, Sizes, Times [optional]
120
 
 
192
 
193
  ## Citation [optional]
194
 
195
+ @misc{t5_sql_askdb,
196
+ author = {Bhanu Prasad Thota},
197
+ title = {T5-SQL AskDB Model},
198
+ year = {2025},
199
+ publisher = {Hugging Face},
200
+ howpublished = {\url{https://huggingface.co/ThotaBhanu/t5_sql_askdb}}
201
+ }
202
+
203
 
204
  **BibTeX:**
205