Instructions to use mlx-community/defog-sqlcoder-7b-2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mlx-community/defog-sqlcoder-7b-2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="mlx-community/defog-sqlcoder-7b-2")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("mlx-community/defog-sqlcoder-7b-2") model = AutoModelForCausalLM.from_pretrained("mlx-community/defog-sqlcoder-7b-2", device_map="auto") - MLX
How to use mlx-community/defog-sqlcoder-7b-2 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("mlx-community/defog-sqlcoder-7b-2") prompt = "Once upon a time in" text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- vLLM
How to use mlx-community/defog-sqlcoder-7b-2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "mlx-community/defog-sqlcoder-7b-2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mlx-community/defog-sqlcoder-7b-2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/mlx-community/defog-sqlcoder-7b-2
- SGLang
How to use mlx-community/defog-sqlcoder-7b-2 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 "mlx-community/defog-sqlcoder-7b-2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mlx-community/defog-sqlcoder-7b-2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "mlx-community/defog-sqlcoder-7b-2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mlx-community/defog-sqlcoder-7b-2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - MLX LM
How to use mlx-community/defog-sqlcoder-7b-2 with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Generate some text mlx_lm.generate --model "mlx-community/defog-sqlcoder-7b-2" --prompt "Once upon a time"
- Docker Model Runner
How to use mlx-community/defog-sqlcoder-7b-2 with Docker Model Runner:
docker model run hf.co/mlx-community/defog-sqlcoder-7b-2
Upload folder using huggingface_hub
Browse files- config.json +2 -2
- model-00001-of-00003.safetensors +1 -1
- model-00002-of-00003.safetensors +1 -1
- model-00003-of-00003.safetensors +1 -1
config.json
CHANGED
|
@@ -19,7 +19,7 @@
|
|
| 19 |
"output_hidden_states": false,
|
| 20 |
"output_attentions": false,
|
| 21 |
"torchscript": false,
|
| 22 |
-
"torch_dtype": "
|
| 23 |
"use_bfloat16": false,
|
| 24 |
"tf_legacy_loss": false,
|
| 25 |
"pruned_heads": {},
|
|
@@ -76,7 +76,7 @@
|
|
| 76 |
"decoder_start_token_id": null,
|
| 77 |
"task_specific_params": null,
|
| 78 |
"problem_type": null,
|
| 79 |
-
"_name_or_path": "/Users/gmcjy/.cache/huggingface/hub/models--defog--sqlcoder-7b-2/snapshots/
|
| 80 |
"transformers_version": "4.37.2",
|
| 81 |
"model_type": "llama"
|
| 82 |
}
|
|
|
|
| 19 |
"output_hidden_states": false,
|
| 20 |
"output_attentions": false,
|
| 21 |
"torchscript": false,
|
| 22 |
+
"torch_dtype": "float16",
|
| 23 |
"use_bfloat16": false,
|
| 24 |
"tf_legacy_loss": false,
|
| 25 |
"pruned_heads": {},
|
|
|
|
| 76 |
"decoder_start_token_id": null,
|
| 77 |
"task_specific_params": null,
|
| 78 |
"problem_type": null,
|
| 79 |
+
"_name_or_path": "/Users/gmcjy/.cache/huggingface/hub/models--defog--sqlcoder-7b-2/snapshots/b645fe3146087c7aedea712a900e208b3a3f0152",
|
| 80 |
"transformers_version": "4.37.2",
|
| 81 |
"model_type": "llama"
|
| 82 |
}
|
model-00001-of-00003.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 5343884067
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5d5d078854b0b42be409d3aabc6ac74e49ff0bc1162574b9f47858897c671418
|
| 3 |
size 5343884067
|
model-00002-of-00003.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 5352158545
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b5affecc3ce18b9ed9a04cfb4bf2d9c25241b59ecc015d6210d00d42b8cad789
|
| 3 |
size 5352158545
|
model-00003-of-00003.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 2781084263
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:017e68dc701004cc4a95ed5cfdedf04e4b5e97e1103c34c6612e2419df78b640
|
| 3 |
size 2781084263
|