Update README.md
Browse files
README.md
CHANGED
@@ -4,6 +4,14 @@ tags:
|
|
4 |
- text-generation
|
5 |
- text-generation-inference
|
6 |
- Inference Endpoints
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
---
|
8 |
|
9 |
# Model Card for Model ID
|
@@ -17,32 +25,63 @@ tags:
|
|
17 |
### Model Description
|
18 |
|
19 |
<!-- Provide a longer summary of what this model is. -->
|
|
|
|
|
|
|
|
|
20 |
|
21 |
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
|
22 |
|
23 |
-
- **Developed by:**
|
24 |
-
- **
|
25 |
-
- **
|
26 |
-
- **
|
27 |
-
- **
|
28 |
-
- **License:** [More Information Needed]
|
29 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
30 |
|
31 |
### Model Sources [optional]
|
32 |
|
33 |
<!-- Provide the basic links for the model. -->
|
34 |
|
35 |
-
- **Repository:**
|
36 |
-
- **Paper [optional]:** [More Information Needed]
|
37 |
-
- **Demo [optional]:** [More Information Needed]
|
38 |
|
39 |
## Uses
|
40 |
|
41 |
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
|
|
42 |
|
43 |
### Direct Use
|
44 |
|
45 |
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
|
47 |
[More Information Needed]
|
48 |
|
@@ -61,6 +100,7 @@ This is the model card of a 🤗 transformers model that has been pushed on the
|
|
61 |
## Bias, Risks, and Limitations
|
62 |
|
63 |
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
|
|
64 |
|
65 |
[More Information Needed]
|
66 |
|
|
|
4 |
- text-generation
|
5 |
- text-generation-inference
|
6 |
- Inference Endpoints
|
7 |
+
license: mit
|
8 |
+
datasets:
|
9 |
+
- omeryentur/text-to-postgresql
|
10 |
+
language:
|
11 |
+
- en
|
12 |
+
metrics:
|
13 |
+
- rouge
|
14 |
+
pipeline_tag: text2text-generation
|
15 |
---
|
16 |
|
17 |
# Model Card for Model ID
|
|
|
25 |
### Model Description
|
26 |
|
27 |
<!-- Provide a longer summary of what this model is. -->
|
28 |
+
This model is fine-trained from the google/flan-t5-base model to achieve better accuracy on generating SQL Queries.
|
29 |
+
It has been trained to generate sql queries given a question and database schema(s).
|
30 |
+
|
31 |
+
It can be used in any of such applications where sql queries are needed (particularly Postgres queries).
|
32 |
|
33 |
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
|
34 |
|
35 |
+
- **Developed by:** Oghenerunor Adjekpiyede
|
36 |
+
- **Model type:** Text2TextGeneration
|
37 |
+
- **Language(s) (NLP):** English
|
38 |
+
- **License:** MIT
|
39 |
+
- **Finetuned from model [optional]:** google/flan-t5-base
|
|
|
|
|
40 |
|
41 |
### Model Sources [optional]
|
42 |
|
43 |
<!-- Provide the basic links for the model. -->
|
44 |
|
45 |
+
- **Repository:** https://huggingface.co/kampkelly/sql-generator
|
|
|
|
|
46 |
|
47 |
## Uses
|
48 |
|
49 |
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
50 |
+
This model is to be used and performs well for generating SQL queries. This model for other tasks may not give satisfactory performance on generating text in other general use cases.
|
51 |
|
52 |
### Direct Use
|
53 |
|
54 |
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
55 |
+
Use with transformers
|
56 |
+
```
|
57 |
+
from peft import PeftModel
|
58 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
59 |
+
|
60 |
+
model_base = AutoModelForSeq2SeqLM.from_pretrained("google/flan-t5-base", torch_dtype=torch.bfloat16, trust_remote_code=True)
|
61 |
+
model = PeftModel.from_pretrained(model_base,
|
62 |
+
peft_model_path,
|
63 |
+
torch_dtype=torch.bfloat16,
|
64 |
+
is_trainable=False)
|
65 |
+
|
66 |
+
input_ids = tokenizer(prompt, padding="max_length", max_length=300, truncation=True, return_tensors="pt").input_ids
|
67 |
+
model_output = model.generate(input_ids=input_ids, max_new_tokens = 300, use_cache = True,
|
68 |
+
num_beams=3,
|
69 |
+
do_sample=True,
|
70 |
+
top_k=50,
|
71 |
+
top_p=0.75,
|
72 |
+
temperature=0.1,
|
73 |
+
early_stopping=True
|
74 |
+
)
|
75 |
+
model_text_output = tokenizer.decode(model_output[0], skip_special_tokens=True)
|
76 |
+
print(model_text)
|
77 |
+
|
78 |
+
```
|
79 |
+
|
80 |
+
----
|
81 |
+
```
|
82 |
+
|
83 |
+
```
|
84 |
+
|
85 |
|
86 |
[More Information Needed]
|
87 |
|
|
|
100 |
## Bias, Risks, and Limitations
|
101 |
|
102 |
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
103 |
+
This model is particularly good for generating SQL `Select` statement queries. Other types of query statements such as Create, Delete, Update, etc are not fully supported.
|
104 |
|
105 |
[More Information Needed]
|
106 |
|