Text Generation
PEFT
Safetensors
MLX
English
text-to-sql
sql
sqlite
lora
bird
spider
Eval Results (legacy)
Instructions to use Felamity-Technologies/sqlant-1b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use Felamity-Technologies/sqlant-1b with PEFT:
Task type is invalid.
- MLX
How to use Felamity-Technologies/sqlant-1b with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # if on a CUDA device, also pip install mlx[cuda] # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("Felamity-Technologies/sqlant-1b") prompt = "Once upon a time in" text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- MLX LM
How to use Felamity-Technologies/sqlant-1b with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Generate some text mlx_lm.generate --model "Felamity-Technologies/sqlant-1b" --prompt "Once upon a time"
- Atomic Chat
File size: 1,602 Bytes
d2bec35 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | """Prompt schema format (copied from the SQLant repository, scripts/build_eval_set.py)."""
import sqlite3
from pathlib import Path
N_EXAMPLE_ROWS = 3
MAX_VAL_CHARS = 40
def _fmt(v):
s = repr(v) if isinstance(v, str) else str(v)
return s if len(s) <= MAX_VAL_CHARS else s[:MAX_VAL_CHARS] + "...'"
def schema_text(db_path: Path) -> str:
con = sqlite3.connect(f"file:{db_path}?mode=ro", uri=True)
con.text_factory = lambda b: b.decode(errors="replace")
cur = con.cursor()
parts = []
tables = cur.execute(
"SELECT name, sql FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%'"
).fetchall()
for name, ddl in tables:
block = ddl.strip() + ";"
try:
rows = cur.execute(f'SELECT * FROM "{name}" LIMIT {N_EXAMPLE_ROWS}').fetchall()
cols = [d[0] for d in cur.description]
if rows:
lines = [" | ".join(cols)] + [" | ".join(_fmt(v) for v in r) for r in rows]
block += f"\n/* {len(rows)} example rows from {name}:\n" + "\n".join(lines) + "\n*/"
except sqlite3.Error:
pass
parts.append(block)
con.close()
return "\n\n".join(parts)
def build_prompt(schema: str, question: str, evidence: str | None) -> str:
p = f"Database schema (SQLite):\n{schema}\n\n"
if evidence:
p += f"External knowledge: {evidence}\n\n"
p += (
f"Question: {question}\n\n"
"Write one SQLite query that answers the question. "
"Return only the SQL inside a ```sql code block, with no explanation."
)
return p
|