Text Generation
Transformers
Safetensors
English
qwen2
text-generation-inference
trl
sft
conversational
Instructions to use Mr-Vicky-01/sql-assistant with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Mr-Vicky-01/sql-assistant with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Mr-Vicky-01/sql-assistant") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Mr-Vicky-01/sql-assistant") model = AutoModelForCausalLM.from_pretrained("Mr-Vicky-01/sql-assistant") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use Mr-Vicky-01/sql-assistant with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Mr-Vicky-01/sql-assistant" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Mr-Vicky-01/sql-assistant", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Mr-Vicky-01/sql-assistant
- SGLang
How to use Mr-Vicky-01/sql-assistant with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Mr-Vicky-01/sql-assistant" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Mr-Vicky-01/sql-assistant", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Mr-Vicky-01/sql-assistant" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Mr-Vicky-01/sql-assistant", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Mr-Vicky-01/sql-assistant with Docker Model Runner:
docker model run hf.co/Mr-Vicky-01/sql-assistant
INFERENCE
import time
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM, TextStreamer
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
finetuned_model = AutoModelForCausalLM.from_pretrained("Mr-Vicky-01/sql-assistant")
finetuned_model.to(device)
tokenizer = AutoTokenizer.from_pretrained("Mr-Vicky-01/sql-assistant")
prompt = """<|im_start|>system
<|im_start|>system
You are a helpful SQL assistant named Securitron. Your working table is 'scans' with the following schema:
CREATE TABLE scans (
id SERIAL PRIMARY KEY,
findings_sca INT,
findings_secrets INT,
findings_compliance INT,
findings_iac INT,
findings_malware INT,
findings_api INT,
findings_pii INT,
findings_container INT,
timestamp TIMESTAMP,
total_findings INT,
fp_vulnerabilities INT,
tp_vulnerabilities INT,
unverified_vulnerabilities INT,
findings_sast INT,
group_id INT,
project_link TEXT,
project TEXT,
repository TEXT,
scan_link TEXT,
scan_id TEXT,
branch TEXT,
commit TEXT,
tags TEXT,
initiator TEXT
);<|im_end|>
<|im_start|>user
Show me yesterday's scan with the fewest API findings.<|im_end|>
<|im_start|>assistant
"""
s = time.time()
encodeds = tokenizer(prompt, return_tensors="pt",truncation=True).input_ids.to(device)
text_streamer = TextStreamer(tokenizer, skip_prompt = True)
# Increase max_new_tokens if needed
response = finetuned_model.generate(
input_ids=encodeds,
streamer=text_streamer,
max_new_tokens=512,
use_cache=True,
pad_token_id=151645,
eos_token_id=151645,
num_return_sequences=1
)
e = time.time()
print(f'time taken:{e-s}')
- Downloads last month
- 6