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
Download code/compare.py from Felamity-Technologies/sqlant-1b: direct link, hf CLI and curl.
- Browser
- Download file 2.44 kB
-
https://huggingface.co/Felamity-Technologies/sqlant-1b/resolve/main/code/compare.py
- Command line
-
hf download hf://Felamity-Technologies/sqlant-1b/code/compare.py
-
curl -L -o compare.py https://huggingface.co/Felamity-Technologies/sqlant-1b/resolve/main/code/compare.py
2.44 kB
| """Parity / accuracy check between two runs of run.py on BIRD dev (e.g. --backend mlx vs --backend torch). | |
| python compare.py --data dev.json --db_root dev_databases RUN_A.progress.jsonl RUN_B.progress.jsonl | |
| Prints, per run, execution accuracy against the gold SQL (set comparison of result rows), and between runs the share | |
| of identical greedy drafts / greedy candidates and the paired gained/lost counts. | |
| """ | |
| import argparse | |
| import json | |
| import sqlite3 | |
| from math import comb | |
| from pathlib import Path | |
| def rows(db, sql): | |
| try: | |
| con = sqlite3.connect(f"file:{db}?mode=ro", uri=True) | |
| con.text_factory = lambda b: b.decode(errors="replace") | |
| r = set(con.execute(sql).fetchall()) | |
| con.close() | |
| return r | |
| except Exception: # noqa: BLE001 | |
| return None | |
| def main(): | |
| ap = argparse.ArgumentParser() | |
| ap.add_argument("--data", required=True) | |
| ap.add_argument("--db_root", required=True) | |
| ap.add_argument("runs", nargs="+") | |
| a = ap.parse_args() | |
| data = json.loads(Path(a.data).read_text()) | |
| runs = [{r["idx"]: r for r in (json.loads(l) for l in Path(f).read_text().splitlines() if l.strip())} for f in a.runs] | |
| ids = sorted(set.intersection(*[set(r) for r in runs])) | |
| gold = {} | |
| correct = [{} for _ in runs] | |
| for i in ids: | |
| ex = data[i] | |
| db = str(Path(a.db_root) / ex["db_id"] / f"{ex['db_id']}.sqlite") | |
| gold[i] = rows(db, ex["SQL"]) | |
| for k, run in enumerate(runs): | |
| p = rows(db, run[i]["sql"]) | |
| correct[k][i] = p is not None and p == gold[i] | |
| for k, f in enumerate(a.runs): | |
| print(f"{f}: EX {100 * sum(correct[k].values()) / len(ids):.1f} on {len(ids)} questions") | |
| if len(runs) == 2: | |
| A, B = runs | |
| same_d = sum(A[i].get("draft", "").strip() == B[i].get("draft", "").strip() for i in ids) | |
| same_g = sum((A[i].get("candidates") or [""])[0].strip() == (B[i].get("candidates") or [""])[0].strip() for i in ids) | |
| w = sum(correct[1][i] and not correct[0][i] for i in ids) | |
| l = sum(correct[0][i] and not correct[1][i] for i in ids) | |
| n = w + l | |
| p = min(1.0, 2 * sum(comb(n, j) for j in range(min(w, l) + 1)) / 2 ** n) if n else 1.0 | |
| print(f"identical greedy drafts {same_d}/{len(ids)}, identical greedy candidates {same_g}/{len(ids)}") | |
| print(f"run B vs run A: +{w} / -{l} (McNemar p = {p:.3f})") | |
| if __name__ == "__main__": | |
| main() | |