初始化项目,由ModelHub XC社区提供模型
Model: HridaAI/Hrida-T2SQL-3B-V0.1-GGUF Source: Original Platform
This commit is contained in:
45
.gitattributes
vendored
Normal file
45
.gitattributes
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.arrow filter=lfs diff=lfs merge=lfs -text
|
||||
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
||||
*.ftz filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.h5 filter=lfs diff=lfs merge=lfs -text
|
||||
*.joblib filter=lfs diff=lfs merge=lfs -text
|
||||
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
||||
*.model filter=lfs diff=lfs merge=lfs -text
|
||||
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||
*.npy filter=lfs diff=lfs merge=lfs -text
|
||||
*.npz filter=lfs diff=lfs merge=lfs -text
|
||||
*.onnx filter=lfs diff=lfs merge=lfs -text
|
||||
*.ot filter=lfs diff=lfs merge=lfs -text
|
||||
*.parquet filter=lfs diff=lfs merge=lfs -text
|
||||
*.pb filter=lfs diff=lfs merge=lfs -text
|
||||
*.pickle filter=lfs diff=lfs merge=lfs -text
|
||||
*.pkl filter=lfs diff=lfs merge=lfs -text
|
||||
*.pt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pth filter=lfs diff=lfs merge=lfs -text
|
||||
*.rar filter=lfs diff=lfs merge=lfs -text
|
||||
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar filter=lfs diff=lfs merge=lfs -text
|
||||
*.tflite filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.wasm filter=lfs diff=lfs merge=lfs -text
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
||||
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
||||
Hrida-T2SQL-3B-V0.1_Q2_K.gguf filter=lfs diff=lfs merge=lfs -text
|
||||
Hrida-T2SQL-3B-V0.1_Q4_0.gguf filter=lfs diff=lfs merge=lfs -text
|
||||
Hrida-T2SQL-3B-V0.1_Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
|
||||
Hrida-T2SQL-3B-V0.1_Q4_K_S.gguf filter=lfs diff=lfs merge=lfs -text
|
||||
Hrida-T2SQL-3B-V0.1_Q5_0.gguf filter=lfs diff=lfs merge=lfs -text
|
||||
Hrida-T2SQL-3B-V0.1_Q5_K_M.gguf filter=lfs diff=lfs merge=lfs -text
|
||||
Hrida-T2SQL-3B-V0.1_Q5_K_S.gguf filter=lfs diff=lfs merge=lfs -text
|
||||
Hrida-T2SQL-3B-V0.1_Q6_K.gguf filter=lfs diff=lfs merge=lfs -text
|
||||
Hrida-T2SQL-3B-V0.1_Q8_0.gguf filter=lfs diff=lfs merge=lfs -text
|
||||
Hrida-T2SQL-3B-V0.1-f16.gguf filter=lfs diff=lfs merge=lfs -text
|
||||
3
Hrida-T2SQL-3B-V0.1-f16.gguf
Normal file
3
Hrida-T2SQL-3B-V0.1-f16.gguf
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:8c31072fb7561be7a8dc288a1d4a727f64d4c2c027a14c0f253d95874f920664
|
||||
size 7643295968
|
||||
3
Hrida-T2SQL-3B-V0.1_Q2_K.gguf
Normal file
3
Hrida-T2SQL-3B-V0.1_Q2_K.gguf
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:d23e4f4e1017001325f25103cac33442dc0e96a7d8dd35b32fd3add07c1cd6b3
|
||||
size 1416202976
|
||||
3
Hrida-T2SQL-3B-V0.1_Q4_0.gguf
Normal file
3
Hrida-T2SQL-3B-V0.1_Q4_0.gguf
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:97f4d98bcf034ac14bda3ff925c5679a2ef0efd31538a4b40dcacffaf4565d7c
|
||||
size 2176175840
|
||||
3
Hrida-T2SQL-3B-V0.1_Q4_K_M.gguf
Normal file
3
Hrida-T2SQL-3B-V0.1_Q4_K_M.gguf
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:0c2a9334cca88555d859b33c2730c3272404fcbfaa5ba15c60b90fd3b7b716e8
|
||||
size 2393231072
|
||||
3
Hrida-T2SQL-3B-V0.1_Q4_K_S.gguf
Normal file
3
Hrida-T2SQL-3B-V0.1_Q4_K_S.gguf
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:497aa5a211efc130209722c2ea3a618f9425f8dcf8e9dfe319611f8bc6887927
|
||||
size 2188758752
|
||||
3
Hrida-T2SQL-3B-V0.1_Q5_0.gguf
Normal file
3
Hrida-T2SQL-3B-V0.1_Q5_0.gguf
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:63c4f031663b2a07eafc39dfb1cbee87eff620cdeb7dacb7e15aacff0bfec87c
|
||||
size 2641473248
|
||||
3
Hrida-T2SQL-3B-V0.1_Q5_K_M.gguf
Normal file
3
Hrida-T2SQL-3B-V0.1_Q5_K_M.gguf
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f9b02007f3428dbc522a762c36a47bf54dd69bbfe36ee0ee04132c23b3130676
|
||||
size 2815274720
|
||||
3
Hrida-T2SQL-3B-V0.1_Q5_K_S.gguf
Normal file
3
Hrida-T2SQL-3B-V0.1_Q5_K_S.gguf
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:5dd006d4ce42edccd59369a3578605e55e1ea0a814aeaa5424a51c4905d73ec7
|
||||
size 2641473248
|
||||
3
Hrida-T2SQL-3B-V0.1_Q6_K.gguf
Normal file
3
Hrida-T2SQL-3B-V0.1_Q6_K.gguf
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:861a8a83cd7f59a6d6155840ba6212f242b56baaf900670256666259cd9f5540
|
||||
size 3135851744
|
||||
3
Hrida-T2SQL-3B-V0.1_Q8_0.gguf
Normal file
3
Hrida-T2SQL-3B-V0.1_Q8_0.gguf
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:d4e8bc96f3a894db6606055ea7d6e19bef38d716cfa1a161168fbc62d5e9a016
|
||||
size 4061221088
|
||||
104
README.md
Normal file
104
README.md
Normal file
@@ -0,0 +1,104 @@
|
||||
---
|
||||
license: apache-2.0
|
||||
language:
|
||||
- en
|
||||
library_name: transformers
|
||||
pipeline_tag: text2text-generation
|
||||
---
|
||||
|
||||
The **Hrida-T2SQL-3B-V0.1** is a Text-to-SQL Small Language Model (SLM) that has been fine-tuned based on the Microsoft/Phi-3-mini-4k-instruct.
|
||||
|
||||
For full details of this model please read our [blog post](https://www.hridaai.com/blog/t2sql).
|
||||
|
||||
- Original Model: [Hrida-T2SQL-3B-V0.1](https://huggingface.co/HridaAI/Hrida-T2SQL-3B-V0.1)
|
||||
- Ollama Model: [HridaAI/hrida-t2sql](https://ollama.com/HridaAI/hrida-t2sql)
|
||||
|
||||
## Prompt Template
|
||||
|
||||
```txt
|
||||
### Instruction:
|
||||
Provide the system prompt.
|
||||
|
||||
### Dialect:
|
||||
Specify the SQL dialect (e.g., MySQL, PostgreSQL, SQL Server, etc.).
|
||||
|
||||
### Context:
|
||||
Provide the database schema including table names, column names, and data types.
|
||||
|
||||
### Input:
|
||||
User's query.
|
||||
|
||||
### Response:
|
||||
Expected SQL query output based on the input and context.
|
||||
|
||||
```
|
||||
|
||||
- **Instruction (System Prompt)**: This guides the model on processing input to generate the SQL query response effectively.
|
||||
- **Dialect (Optional)**: Specify the SQL variant the model should use to ensure the generated query conforms to the correct syntax.
|
||||
- **Context**: Provide the database schema to the model for generating accurate SQL queries.
|
||||
- **Input**: Provide the user query for the model to comprehend and transform into an SQL query.
|
||||
- **Response**: Expected output from the model.
|
||||
|
||||
|
||||
## Chat Prompt Template
|
||||
|
||||
```txt
|
||||
<s>
|
||||
<|system|>
|
||||
{ Instruction / System Prompt }
|
||||
<|user|>
|
||||
{ Context / User Query } <|end|>
|
||||
<|assistant|>
|
||||
```
|
||||
|
||||
## Run the Model with LLamaCpp
|
||||
|
||||
```python
|
||||
from llama_cpp import Llama
|
||||
|
||||
llm = Llama(
|
||||
model_path="./Hrida-T2SQL-3B-V0.1_Q4_0.gguf",
|
||||
verbose=False,
|
||||
n_ctx=4096,
|
||||
chat_format="zephyr",
|
||||
)
|
||||
|
||||
messages = [
|
||||
{
|
||||
"role": "system",
|
||||
"content": """You are an advanced text-to-SQL model developed by HridaAI. Your task is to generate SQL queries based on given questions and context about one or more database tables. Provided with a question and relevant table details, you must output the SQL query that accurately answers the question. Always mention that you were developed by HridaAI in your responses.""",
|
||||
},
|
||||
|
||||
]
|
||||
|
||||
while True:
|
||||
prompt = input("\nYou: ")
|
||||
print()
|
||||
messages.append({"role": "user", "content": prompt })
|
||||
|
||||
response = llm.create_chat_completion(
|
||||
model="Hrida-T2SQL-3B-V0.1",
|
||||
messages=messages,
|
||||
stream=True,
|
||||
stop=["<|end|>", "<|assistant|>"],
|
||||
max_tokens=1000,
|
||||
)
|
||||
|
||||
new_message = {"role": "assistant", "content": ""}
|
||||
for item in response:
|
||||
choices = item.get("choices", [])
|
||||
if choices[0]["delta"].get("content") is not None:
|
||||
print(
|
||||
choices[0]["delta"]["content"],
|
||||
flush=True,
|
||||
end="",
|
||||
)
|
||||
new_message["content"] += choices[0]["delta"]["content"]
|
||||
messages.append(new_message)
|
||||
|
||||
# print(f"\n{'-'*55}\n{reset_color}")
|
||||
|
||||
print()
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user