Instructions to use eglym/DR-TEXT2SQL-CodeLlama2-7B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use eglym/DR-TEXT2SQL-CodeLlama2-7B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="eglym/DR-TEXT2SQL-CodeLlama2-7B")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("eglym/DR-TEXT2SQL-CodeLlama2-7B") model = AutoModelForCausalLM.from_pretrained("eglym/DR-TEXT2SQL-CodeLlama2-7B", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use eglym/DR-TEXT2SQL-CodeLlama2-7B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "eglym/DR-TEXT2SQL-CodeLlama2-7B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "eglym/DR-TEXT2SQL-CodeLlama2-7B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/eglym/DR-TEXT2SQL-CodeLlama2-7B
- SGLang
How to use eglym/DR-TEXT2SQL-CodeLlama2-7B 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 "eglym/DR-TEXT2SQL-CodeLlama2-7B" \ --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": "eglym/DR-TEXT2SQL-CodeLlama2-7B", "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 "eglym/DR-TEXT2SQL-CodeLlama2-7B" \ --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": "eglym/DR-TEXT2SQL-CodeLlama2-7B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use eglym/DR-TEXT2SQL-CodeLlama2-7B with Docker Model Runner:
docker model run hf.co/eglym/DR-TEXT2SQL-CodeLlama2-7B
|
Download README.md from eglym/DR-TEXT2SQL-CodeLlama2-7B: direct link, hf CLI and curl.
- Browser
- Download file 2.01 kB
-
https://huggingface.co/eglym/DR-TEXT2SQL-CodeLlama2-7B/resolve/main/README.md
- Command line
-
hf download hf://eglym/DR-TEXT2SQL-CodeLlama2-7B/README.md
-
curl -L -o README.md https://huggingface.co/eglym/DR-TEXT2SQL-CodeLlama2-7B/resolve/main/README.md
2.01 kB
| license: cc-by-sa-4.0 | |
| datasets: | |
| - xlangai/spider | |
| language: | |
| - en | |
| base_model: | |
| - codellama/CodeLlama-7b-Instruct-hf | |
| pipeline_tag: text-generation | |
| library_name: transformers | |
| tags: | |
| - code | |
| # Update notice | |
| The model weights were updated at 3 AM UTC on Sep 12, 2024. | |
| # Model Card for DR-TEXT2SQL-CodeLlama2-7B | |
| A capable large language model for natural language to SQL generation. | |
| ## Model Details | |
| ### Model Description | |
| This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated. | |
| Developed by: eglym | |
| Model type: [Text to SQL] | |
| License: [CC-by-SA-4.0] | |
| Finetuned from model: [CodeLlama-7B] | |
| Uses | |
| This model is intended to be used by non-technical users to understand data inside their SQL databases. It is meant as an analytics tool, and not as a database admin tool. | |
| This model has not been trained to reject malicious requests from users with write access to databases, and should only be used by users with read-only access. | |
| How to Get Started with the Model | |
| Use the code here to get started with the model. | |
| Prompt | |
| Please use the following prompt for optimal results. Please remember to use do_sample=False and num_beams=4 for optimal results. | |
| ### Task | |
| Generate a SQL query to answer user_question. | |
| ### Answer | |
| Given the database schema, here is the SQL query that realize user_question. | |
| Evaluation | |
| This model was evaluated on SQL-Eval, a PostgreSQL based evaluation framework developed by Defog for testing and alignment of model capabilities. | |
| You can read more about the methodology behind SQLEval here. | |
| Results | |
| We classified each generated question into one of 6 categories. The table displays the percentage of questions answered correctly by each model, broken down by category. | |
| ```bash | |
| easy medium hard extra all | |
| count 250 440 174 170 1034 | |
| compare etype exec | |
| ===================== EXECUTION ACCURACY ===================== | |
| exec 0.899 0.805 0.655 0.464 0.748 | |
| ``` |