Instructions to use defog/sqlcoder with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use defog/sqlcoder with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="defog/sqlcoder")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("defog/sqlcoder") model = AutoModelForCausalLM.from_pretrained("defog/sqlcoder") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use defog/sqlcoder with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "defog/sqlcoder" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "defog/sqlcoder", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/defog/sqlcoder
- SGLang
How to use defog/sqlcoder 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 "defog/sqlcoder" \ --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": "defog/sqlcoder", "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 "defog/sqlcoder" \ --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": "defog/sqlcoder", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use defog/sqlcoder with Docker Model Runner:
docker model run hf.co/defog/sqlcoder
[AUTOMATED] Model Memory Requirements
Model Memory Requirements
You will need about {'dtype': 'float16/bfloat16', 'Largest Layer or Residual Group': '723.13 MB', 'Total Size': '28.91 GB', 'Training using Adam': '115.63 GB'} VRAM to load this model for inference, and {'dtype': 'int4', 'Largest Layer or Residual Group': '180.78 MB', 'Total Size': '7.23 GB', 'Training using Adam': '28.91 GB'} VRAM to train it using Adam.
These calculations were measured from the Model Memory Utility Space on the Hub.
The minimum recommended vRAM needed for this model assumes using Accelerate or device_map="auto" and is denoted by the size of the "largest layer".
When performing inference, expect to add up to an additional 20% to this, as found by EleutherAI. More tests will be performed in the future to get a more accurate benchmark for each model.
When training with Adam, you can expect roughly 4x the reported results to be used. (1x for the model, 1x for the gradients, and 2x for the optimizer).
Results:
| dtype | Largest Layer or Residual Group | Total Size | Training using Adam |
|---|---|---|---|
| float32 | 1.41 GB | 57.81 GB | 231.26 GB |
| float16/bfloat16 | 723.13 MB | 28.91 GB | 115.63 GB |
| int8 | 361.56 MB | 14.45 GB | 57.81 GB |
| int4 | 180.78 MB | 7.23 GB | 28.91 GB |