Run this model with HF Jobs

Run OneGate/OGSQL-Mistral-7B on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs and TRL to fine-tune https://huggingface.co/OneGate/OGSQL-Mistral-7B. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/OneGate/OGSQL-Mistral-7B on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

Evaluate on a benchmark

Use HF Jobs to evaluate https://huggingface.co/OneGate/OGSQL-Mistral-7B. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.

Quantize for lower memory use

Use HF Jobs to create a 4-bit version of https://huggingface.co/OneGate/OGSQL-Mistral-7B. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.

OGSQL-Mistral7B

image/png

Model Description

OGSQL-Mistral7B was fine-tuned for the task of converting natural language text into SQL queries.

  • Model type: Mixture Of Experts (MoE)
  • Language(s) (NLP): SQL (target language for generation)
  • Finetuned from model: Mistral 7B instruct

Use Case

OGSQL-7B is designed to facilitate the conversion of natural language queries into structured SQL commands, aiding in database querying without the need for manual SQL knowledge.

How to Get Started with the Model

# Example code to load and use the model
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer

model_name = "OGSQL-Mistral7B"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)

def generate_sql(query):
    inputs = tokenizer.encode(query, return_tensors="pt")
    outputs = model.generate(inputs)
    return tokenizer.decode(outputs[0], skip_special_tokens=True)

# Example use
query = """
using this context:
-- Create Customers Table
CREATE TABLE Customers (
    customer_id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    email TEXT,
    join_date DATE
);

-- Create Products Table
CREATE TABLE Products (
    product_id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    price DECIMAL(10, 2)
);

-- Create Orders Table
CREATE TABLE Orders (
    order_id INTEGER PRIMARY KEY,
    customer_id INTEGER,
    product_id INTEGER,
    order_date DATE,
    quantity INTEGER,
    total_price DECIMAL(10, 2),
    FOREIGN KEY (customer_id) REFERENCES Customers(customer_id),
    FOREIGN KEY (product_id) REFERENCES Products(product_id)
);

show me all the orders from last month , sort by date


"""
print(generate_sql(query))

alternatively you can use this notebook:

Colab notebook

Downloads last month
13
Safetensors
Model size
7B params
Tensor type
F16
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for OneGate/OGSQL-Mistral-7B

Quantizations
2 models