Text Generation
Transformers
PyTorch
English
t5
text2text-generation
SQL
plSQL
english
text-generation-inference
Instructions to use MRNH/flan-t5-large-PLsql with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MRNH/flan-t5-large-PLsql with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="MRNH/flan-t5-large-PLsql")# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("MRNH/flan-t5-large-PLsql") model = AutoModelForSeq2SeqLM.from_pretrained("MRNH/flan-t5-large-PLsql") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use MRNH/flan-t5-large-PLsql with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "MRNH/flan-t5-large-PLsql" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MRNH/flan-t5-large-PLsql", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/MRNH/flan-t5-large-PLsql
- SGLang
How to use MRNH/flan-t5-large-PLsql 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 "MRNH/flan-t5-large-PLsql" \ --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": "MRNH/flan-t5-large-PLsql", "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 "MRNH/flan-t5-large-PLsql" \ --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": "MRNH/flan-t5-large-PLsql", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use MRNH/flan-t5-large-PLsql with Docker Model Runner:
docker model run hf.co/MRNH/flan-t5-large-PLsql
Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
pipeline_tag: text2text-generation
|
| 5 |
+
metrics:
|
| 6 |
+
- f1
|
| 7 |
+
tags:
|
| 8 |
+
- SQL
|
| 9 |
+
- plSQL
|
| 10 |
+
- english
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
This is a fine-tuned version of T5 FLAN LARGE (783M) on English in particular on the public dataset spider for text-toSQL.
|
| 14 |
+
|
| 15 |
+
To initialize the model:
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
from transformers import T5ForConditionalGeneration
|
| 19 |
+
model = T5ForConditionalGeneration.from_pretrained("MRNH/flan-t5-large-PLsql")
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
Use the tokenizer:
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
tokenizer = T5ForConditionalGeneration.from_pretrained("MRNH/flan-t5-large-PLsql")
|
| 26 |
+
|
| 27 |
+
input = tokenizer("<question> "+sentence["db_id"]+" </question> "+sentence["question"],
|
| 28 |
+
text_target=sentence["query"], return_tensors='pt')
|
| 29 |
+
|
| 30 |
+
To generate text using the model:
|
| 31 |
+
|
| 32 |
+
output = model.generate(input["input_ids"],attention_mask=input["attention_mask"])
|
| 33 |
+
|
| 34 |
+
Training of the model is performed using the following loss computation based on the hidden state output h:
|
| 35 |
+
|
| 36 |
+
h.logits, h.loss = model(input_ids=input["input_ids"],
|
| 37 |
+
attention_mask=input["attention_mask"],
|
| 38 |
+
labels=input["labels"])
|