Downloads · 30 days
152
9% of all-time downloads
RichardErkhov/HridaAI_-_Hrida-T2SQL-3B-V0.1-gguf
HridaAI_-_Hrida-T2SQL-3B-V0.1-gguf is a machine learning model from RichardErkhov. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Downloads · 30 days
152
9% of all-time downloads
All-time downloads
1.7K
Public
Repo size
43.9 GB
Likes
0
Public
Click a slice to open those files.
.gguf51.1 GB · 100%
From the Hugging Face model README
Quantization made by Richard Erkhov.
Hrida-T2SQL-3B-V0.1 - GGUF
| Name | Quant method | Size |
|---|---|---|
| Hrida-T2SQL-3B-V0.1.Q2_K.gguf | Q2_K | 1.32GB |
| Hrida-T2SQL-3B-V0.1.IQ3_XS.gguf | IQ3_XS | 1.51GB |
| Hrida-T2SQL-3B-V0.1.IQ3_S.gguf | IQ3_S | 1.57GB |
| Hrida-T2SQL-3B-V0.1.Q3_K_S.gguf | Q3_K_S | 1.57GB |
| Hrida-T2SQL-3B-V0.1.IQ3_M.gguf | IQ3_M | 1.73GB |
| Hrida-T2SQL-3B-V0.1.Q3_K.gguf | Q3_K | 1.82GB |
| Hrida-T2SQL-3B-V0.1.Q3_K_M.gguf | Q3_K_M | 1.82GB |
| Hrida-T2SQL-3B-V0.1.Q3_K_L.gguf | Q3_K_L | 1.94GB |
| Hrida-T2SQL-3B-V0.1.IQ4_XS.gguf | IQ4_XS | 1.93GB |
| Hrida-T2SQL-3B-V0.1.Q4_0.gguf | Q4_0 | 2.03GB |
| Hrida-T2SQL-3B-V0.1.IQ4_NL.gguf | IQ4_NL | 2.04GB |
| Hrida-T2SQL-3B-V0.1.Q4_K_S.gguf | Q4_K_S | 2.04GB |
| Hrida-T2SQL-3B-V0.1.Q4_K.gguf | Q4_K | 2.23GB |
| Hrida-T2SQL-3B-V0.1.Q4_K_M.gguf | Q4_K_M | 2.23GB |
| Hrida-T2SQL-3B-V0.1.Q4_1.gguf | Q4_1 | 2.24GB |
| Hrida-T2SQL-3B-V0.1.Q5_0.gguf | Q5_0 | 2.46GB |
| Hrida-T2SQL-3B-V0.1.Q5_K_S.gguf | Q5_K_S | 2.46GB |
| Hrida-T2SQL-3B-V0.1.Q5_K.gguf | Q5_K | 2.62GB |
| Hrida-T2SQL-3B-V0.1.Q5_K_M.gguf | Q5_K_M | 2.62GB |
| Hrida-T2SQL-3B-V0.1.Q5_1.gguf | Q5_1 | 2.68GB |
| Hrida-T2SQL-3B-V0.1.Q6_K.gguf | Q6_K | 2.92GB |
| Hrida-T2SQL-3B-V0.1.Q8_0.gguf | Q8_0 | 3.78GB |
license: apache-2.0 language:
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.
### 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.
<s>
<|system|>
{ Instruction / System Prompt }
<|user|>
{ Context / User Query } <|end|>
<|assistant|>
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
# Define the model and tokenizer
model_id = "HridaAI/Hrida-T2SQL-3B-V0.1"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.float16, trust_remote_code=True)
# Define the context and prompt
prompt = """
Answer to the query will be in the form of an SQL query.
### Context: CREATE TABLE Employees (
EmployeeID INT PRIMARY KEY,
FirstName VARCHAR(50),
LastName VARCHAR(50),
Age INT,
DepartmentID INT,
Salary DECIMAL(10, 2),
DateHired DATE,
Active BOOLEAN,
FOREIGN KEY (DepartmentID) REFERENCES Departments(DepartmentID)
);
CREATE TABLE Departments (
DepartmentID INT PRIMARY KEY,
DepartmentName VARCHAR(100),
Location VARCHAR(100)
);
### Input: Write a SQL query to select all the employees who are active.
### Response:
"""
# Prepare the input
messages = [{"role": "user", "content": prompt}]
inputs = tokenizer.apply_chat_template(messages, return_tensors="pt", add_generation_prompt=True)
# Generate the output
outputs = model.generate(inputs, max_length=300)
print(tokenizer.decode(outputs[0]))
from mlx_lm import generate, load
model,tokenizer = load("HridaAI/Hrida-T2SQL-3B-V0.1")
prompt = """
Answer to the quey will be in the form of SQL query.
### Context: CREATE TABLE Employees (
EmployeeID INT PRIMARY KEY,
FirstName VARCHAR(50),
LastName VARCHAR(50),
Age INT,
DepartmentID INT,
Salary DECIMAL(10, 2),
DateHired DATE,
Active BOOLEAN,
FOREIGN KEY (DepartmentID) REFERENCES Departments(DepartmentID)
);
CREATE TABLE Departments (
DepartmentID INT PRIMARY KEY,
DepartmentName VARCHAR(100),
Location VARCHAR(100)
); ### Input: Write a SQL query to select all the employees who are active. ### Response:"""
response = generate(model=model,tokenizer=tokenizer,prompt=prompt, verbose=True)