Instructions to use ekshat/Llama-2-7b-chat-finetune-for-text2sql with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ekshat/Llama-2-7b-chat-finetune-for-text2sql with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ekshat/Llama-2-7b-chat-finetune-for-text2sql")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("ekshat/Llama-2-7b-chat-finetune-for-text2sql") model = AutoModelForCausalLM.from_pretrained("ekshat/Llama-2-7b-chat-finetune-for-text2sql", device_map="auto") - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ekshat/Llama-2-7b-chat-finetune-for-text2sql with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ekshat/Llama-2-7b-chat-finetune-for-text2sql" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ekshat/Llama-2-7b-chat-finetune-for-text2sql", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/ekshat/Llama-2-7b-chat-finetune-for-text2sql
- SGLang
How to use ekshat/Llama-2-7b-chat-finetune-for-text2sql 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 "ekshat/Llama-2-7b-chat-finetune-for-text2sql" \ --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": "ekshat/Llama-2-7b-chat-finetune-for-text2sql", "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 "ekshat/Llama-2-7b-chat-finetune-for-text2sql" \ --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": "ekshat/Llama-2-7b-chat-finetune-for-text2sql", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use ekshat/Llama-2-7b-chat-finetune-for-text2sql with Docker Model Runner:
docker model run hf.co/ekshat/Llama-2-7b-chat-finetune-for-text2sql
Update README.md
Browse files
README.md
CHANGED
|
@@ -25,7 +25,7 @@ from transformers import AutoTokenizer, AutoModelForCausalLM
|
|
| 25 |
tokenizer = AutoTokenizer.from_pretrained("ekshat/Llama-2-7b-chat-finetune-for-text2sql")
|
| 26 |
model = AutoModelForCausalLM.from_pretrained("ekshat/Llama-2-7b-chat-finetune-for-text2sql")
|
| 27 |
|
| 28 |
-
# Run text generation pipeline with our
|
| 29 |
context = "CREATE TABLE Student (name VARCHAR, college VARCHAR, age VARCHAR, group VARCHAR, marks VARCHAR)"
|
| 30 |
question = "List the name of Students belongs to school 'St. Xavier' and having marks greater than '600'"
|
| 31 |
|
|
@@ -37,14 +37,14 @@ prompt = f"""Below is an context that describes a sql query, paired with an ques
|
|
| 37 |
### Answer:"""
|
| 38 |
|
| 39 |
sequences = pipeline(
|
| 40 |
-
prompt,
|
| 41 |
-
do_sample=True,
|
| 42 |
-
top_k=10,
|
| 43 |
-
num_return_sequences=1,
|
| 44 |
-
eos_token_id=tokenizer.eos_token_id,
|
| 45 |
-
max_length=200,
|
| 46 |
)
|
| 47 |
for seq in sequences:
|
| 48 |
-
print(f"Result: {seq['generated_text']}")
|
| 49 |
|
| 50 |
```
|
|
|
|
| 25 |
tokenizer = AutoTokenizer.from_pretrained("ekshat/Llama-2-7b-chat-finetune-for-text2sql")
|
| 26 |
model = AutoModelForCausalLM.from_pretrained("ekshat/Llama-2-7b-chat-finetune-for-text2sql")
|
| 27 |
|
| 28 |
+
# Run text generation pipeline with our model
|
| 29 |
context = "CREATE TABLE Student (name VARCHAR, college VARCHAR, age VARCHAR, group VARCHAR, marks VARCHAR)"
|
| 30 |
question = "List the name of Students belongs to school 'St. Xavier' and having marks greater than '600'"
|
| 31 |
|
|
|
|
| 37 |
### Answer:"""
|
| 38 |
|
| 39 |
sequences = pipeline(
|
| 40 |
+
prompt,
|
| 41 |
+
do_sample=True,
|
| 42 |
+
top_k=10,
|
| 43 |
+
num_return_sequences=1,
|
| 44 |
+
eos_token_id=tokenizer.eos_token_id,
|
| 45 |
+
max_length=200,
|
| 46 |
)
|
| 47 |
for seq in sequences:
|
| 48 |
+
print(f"Result: {seq['generated_text']}")
|
| 49 |
|
| 50 |
```
|