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,414 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 | """MLX backend (Apple Silicon): the evaluated reference implementation, used for parity checks."""
from .pipeline import MAX_TOKENS, TOP_P
class MLXBackend:
def __init__(self, base, generator, verifier, seed=0):
import mlx.core as mx
from mlx_lm import load
self.mx = mx
self.gen_model, self.tok = load(base, adapter_path=generator)
self.ver_model, self.vtok = load(base, adapter_path=verifier)
self.yes, self.no = self.vtok.encode("yes")[0], self.vtok.encode("no")[0]
mx.random.seed(seed)
def generate(self, messages, n, temp):
from mlx_lm import batch_generate
from mlx_lm.sample_utils import make_sampler
ids = self.tok.apply_chat_template(messages, add_generation_prompt=True)
sampler = make_sampler(temp=0.0) if temp == 0.0 else make_sampler(temp=temp, top_p=TOP_P)
out = batch_generate(self.gen_model, self.tok, [ids] * n, max_tokens=MAX_TOKENS, sampler=sampler).texts
self.mx.clear_cache()
return out
def score(self, user):
ids = self.vtok.apply_chat_template([{"role": "user", "content": user}], add_generation_prompt=True)
if isinstance(ids, dict) or hasattr(ids, "keys"):
ids = ids["input_ids"]
v = (lambda lg: (lg[self.yes] - lg[self.no]).item())(self.ver_model(self.mx.array([ids]))[0, -1])
self.mx.clear_cache()
return v
|