Text Generation
Transformers
Safetensors
English
Chinese
llama
text2sql
conversational
text-generation-inference
Instructions to use xbrain/AutoSQL-nl2sql-1.0-8b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use xbrain/AutoSQL-nl2sql-1.0-8b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="xbrain/AutoSQL-nl2sql-1.0-8b") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("xbrain/AutoSQL-nl2sql-1.0-8b") model = AutoModelForCausalLM.from_pretrained("xbrain/AutoSQL-nl2sql-1.0-8b", device_map="auto") 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 Settings
- vLLM
How to use xbrain/AutoSQL-nl2sql-1.0-8b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "xbrain/AutoSQL-nl2sql-1.0-8b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "xbrain/AutoSQL-nl2sql-1.0-8b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/xbrain/AutoSQL-nl2sql-1.0-8b
- SGLang
How to use xbrain/AutoSQL-nl2sql-1.0-8b 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 "xbrain/AutoSQL-nl2sql-1.0-8b" \ --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": "xbrain/AutoSQL-nl2sql-1.0-8b", "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 "xbrain/AutoSQL-nl2sql-1.0-8b" \ --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": "xbrain/AutoSQL-nl2sql-1.0-8b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use xbrain/AutoSQL-nl2sql-1.0-8b with Docker Model Runner:
docker model run hf.co/xbrain/AutoSQL-nl2sql-1.0-8b
Update README.md
Browse files
README.md
CHANGED
|
@@ -66,6 +66,7 @@ print(outputs[0]["generated_text"][-1])
|
|
| 66 |
```
|
| 67 |
|
| 68 |
Here are some exciting examples:
|
|
|
|
| 69 |
**Example 1:**
|
| 70 |
- model input:
|
| 71 |
{"role": "system",
|
|
@@ -76,6 +77,7 @@ Here are some exciting examples:
|
|
| 76 |
- model output:
|
| 77 |
{'role': 'assistant', 'content': 'SELECT T1.cost_of_treatment, T2.treatment_type_description FROM Treatments AS T1 JOIN treatment_types AS T2 ON T1.treatment_type_code = T2.treatment_type_code'}
|
| 78 |
|
|
|
|
| 79 |
**Example 2:**
|
| 80 |
- model input:
|
| 81 |
{"role": "system",
|
|
@@ -87,6 +89,7 @@ Here are some exciting examples:
|
|
| 87 |
{'role': 'assistant', 'content': "SELECT COUNT(*) > 0 FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-15666')) AND microlab.culturesite = 'urine, catheter specimen' AND DATETIME(microlab.culturetakentime,'start of month') = DATETIME(CURRENT_TIME(),'start of month', '-1 month') ORDER BY microlab.culturetakentime LIMIT 1"}
|
| 88 |
|
| 89 |
|
|
|
|
| 90 |
## 3. Ethical Considerations
|
| 91 |
|
| 92 |
While fine-tuned for text to sql, this model inherits the ethical considerations of the base Llama 3 model. Use responsibly and implement additional safeguards as needed for your application.
|
|
|
|
| 66 |
```
|
| 67 |
|
| 68 |
Here are some exciting examples:
|
| 69 |
+
|
| 70 |
**Example 1:**
|
| 71 |
- model input:
|
| 72 |
{"role": "system",
|
|
|
|
| 77 |
- model output:
|
| 78 |
{'role': 'assistant', 'content': 'SELECT T1.cost_of_treatment, T2.treatment_type_description FROM Treatments AS T1 JOIN treatment_types AS T2 ON T1.treatment_type_code = T2.treatment_type_code'}
|
| 79 |
|
| 80 |
+
|
| 81 |
**Example 2:**
|
| 82 |
- model input:
|
| 83 |
{"role": "system",
|
|
|
|
| 89 |
{'role': 'assistant', 'content': "SELECT COUNT(*) > 0 FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-15666')) AND microlab.culturesite = 'urine, catheter specimen' AND DATETIME(microlab.culturetakentime,'start of month') = DATETIME(CURRENT_TIME(),'start of month', '-1 month') ORDER BY microlab.culturetakentime LIMIT 1"}
|
| 90 |
|
| 91 |
|
| 92 |
+
|
| 93 |
## 3. Ethical Considerations
|
| 94 |
|
| 95 |
While fine-tuned for text to sql, this model inherits the ethical considerations of the base Llama 3 model. Use responsibly and implement additional safeguards as needed for your application.
|