Instructions to use ByteForge/Defog_llama-3-sqlcoder-8b-ct2-int8_float16 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ByteForge/Defog_llama-3-sqlcoder-8b-ct2-int8_float16 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ByteForge/Defog_llama-3-sqlcoder-8b-ct2-int8_float16") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("ByteForge/Defog_llama-3-sqlcoder-8b-ct2-int8_float16", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use ByteForge/Defog_llama-3-sqlcoder-8b-ct2-int8_float16 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ByteForge/Defog_llama-3-sqlcoder-8b-ct2-int8_float16" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ByteForge/Defog_llama-3-sqlcoder-8b-ct2-int8_float16", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ByteForge/Defog_llama-3-sqlcoder-8b-ct2-int8_float16
- SGLang
How to use ByteForge/Defog_llama-3-sqlcoder-8b-ct2-int8_float16 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 "ByteForge/Defog_llama-3-sqlcoder-8b-ct2-int8_float16" \ --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": "ByteForge/Defog_llama-3-sqlcoder-8b-ct2-int8_float16", "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 "ByteForge/Defog_llama-3-sqlcoder-8b-ct2-int8_float16" \ --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": "ByteForge/Defog_llama-3-sqlcoder-8b-ct2-int8_float16", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use ByteForge/Defog_llama-3-sqlcoder-8b-ct2-int8_float16 with Docker Model Runner:
docker model run hf.co/ByteForge/Defog_llama-3-sqlcoder-8b-ct2-int8_float16
Update README.md
Browse files
README.md
CHANGED
|
@@ -43,9 +43,50 @@ model_path = snapshot_download(model_id)
|
|
| 43 |
model = ctranslate2.Generator(model_path)
|
| 44 |
tokenizer = transformers.AutoTokenizer.from_pretrained(model_id)
|
| 45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
messages = [
|
| 47 |
{"role": "system", "content": "You are a pirate chatbot who always responds in pirate speak!"},
|
| 48 |
-
{"role": "user", "content":
|
| 49 |
]
|
| 50 |
|
| 51 |
input_ids = tokenizer.apply_chat_template(
|
|
|
|
| 43 |
model = ctranslate2.Generator(model_path)
|
| 44 |
tokenizer = transformers.AutoTokenizer.from_pretrained(model_id)
|
| 45 |
|
| 46 |
+
prompt="""
|
| 47 |
+
CREATE TABLE stadium (
|
| 48 |
+
stadium_id number,
|
| 49 |
+
location text,
|
| 50 |
+
name text,
|
| 51 |
+
capacity number,
|
| 52 |
+
highest number,
|
| 53 |
+
lowest number,
|
| 54 |
+
average number
|
| 55 |
+
)
|
| 56 |
+
|
| 57 |
+
CREATE TABLE singer (
|
| 58 |
+
singer_id number,
|
| 59 |
+
name text,
|
| 60 |
+
country text,
|
| 61 |
+
song_name text,
|
| 62 |
+
song_release_year text,
|
| 63 |
+
age number,
|
| 64 |
+
is_male others
|
| 65 |
+
)
|
| 66 |
+
|
| 67 |
+
CREATE TABLE concert (
|
| 68 |
+
concert_id number,
|
| 69 |
+
concert_name text,
|
| 70 |
+
theme text,
|
| 71 |
+
stadium_id text,
|
| 72 |
+
year text
|
| 73 |
+
)
|
| 74 |
+
|
| 75 |
+
CREATE TABLE singer_in_concert (
|
| 76 |
+
concert_id number,
|
| 77 |
+
singer_id text
|
| 78 |
+
)
|
| 79 |
+
|
| 80 |
+
-- Using valid SQLite, answer the following questions for the tables provided above.
|
| 81 |
+
|
| 82 |
+
-- What is the maximum, the average, and the minimum capacity of stadiums ? (Generate 1 Sql query. No explaination needed)
|
| 83 |
+
|
| 84 |
+
answer:
|
| 85 |
+
"""
|
| 86 |
+
|
| 87 |
messages = [
|
| 88 |
{"role": "system", "content": "You are a pirate chatbot who always responds in pirate speak!"},
|
| 89 |
+
{"role": "user", "content": prompt},
|
| 90 |
]
|
| 91 |
|
| 92 |
input_ids = tokenizer.apply_chat_template(
|