Update README.md
Browse files
README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
---
|
2 |
library_name: transformers
|
3 |
-
|
|
|
4 |
---
|
5 |
|
6 |
# Model Card for Model ID
|
@@ -35,7 +36,47 @@ This is the model card of a 🤗 transformers model that has been pushed on the
|
|
35 |
|
36 |
## Uses
|
37 |
|
38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
|
40 |
### Direct Use
|
41 |
|
|
|
1 |
---
|
2 |
library_name: transformers
|
3 |
+
base_model:
|
4 |
+
- Qwen/Qwen2.5-1.5B-Instruct
|
5 |
---
|
6 |
|
7 |
# Model Card for Model ID
|
|
|
36 |
|
37 |
## Uses
|
38 |
|
39 |
+
context = """
|
40 |
+
|
41 |
+
"""
|
42 |
+
|
43 |
+
input_question = ""
|
44 |
+
|
45 |
+
prompt = f"""
|
46 |
+
### Instruction:
|
47 |
+
Based on the database schema description, generate the correct SQL query to answer the following question.
|
48 |
+
|
49 |
+
### Context:
|
50 |
+
{context}
|
51 |
+
|
52 |
+
### Input:
|
53 |
+
{input_question}
|
54 |
+
|
55 |
+
### Output:
|
56 |
+
"""
|
57 |
+
|
58 |
+
tokens = tokenizer(prompt, return_tensors="pt").to("cuda")
|
59 |
+
output = model.generate(
|
60 |
+
**tokens,
|
61 |
+
temperature=1,
|
62 |
+
max_new_tokens=100,
|
63 |
+
repetition_penalty=1.2,
|
64 |
+
top_p=0.9,
|
65 |
+
no_repeat_ngram_size=3
|
66 |
+
)
|
67 |
+
|
68 |
+
result = tokenizer.decode(output[0], skip_special_tokens=True)
|
69 |
+
|
70 |
+
# Chỉ lấy phần sau "### Output:"
|
71 |
+
import re
|
72 |
+
|
73 |
+
output_start = re.search(r"### Output:\s*(.*)", result, re.DOTALL)
|
74 |
+
if output_start:
|
75 |
+
result = output_start.group(1).strip()
|
76 |
+
print(result)
|
77 |
+
|
78 |
+
|
79 |
+
|
80 |
|
81 |
### Direct Use
|
82 |
|