Text Generation
Transformers
PyTorch
Safetensors
Polish
English
t5
text2text-generation
keywords-generation
text-classifiation
other
text-generation-inference
Instructions to use Voicelab/vlt5-base-keywords with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Voicelab/vlt5-base-keywords with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Voicelab/vlt5-base-keywords")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("Voicelab/vlt5-base-keywords") model = AutoModelForSeq2SeqLM.from_pretrained("Voicelab/vlt5-base-keywords", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Voicelab/vlt5-base-keywords with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Voicelab/vlt5-base-keywords" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Voicelab/vlt5-base-keywords", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Voicelab/vlt5-base-keywords
- SGLang
How to use Voicelab/vlt5-base-keywords 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 "Voicelab/vlt5-base-keywords" \ --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": "Voicelab/vlt5-base-keywords", "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 "Voicelab/vlt5-base-keywords" \ --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": "Voicelab/vlt5-base-keywords", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Voicelab/vlt5-base-keywords with Docker Model Runner:
docker model run hf.co/Voicelab/vlt5-base-keywords
Update README.md
Browse files
README.md
CHANGED
|
@@ -84,16 +84,20 @@ model = T5ForConditionalGeneration.from_pretrained("Voicelab/vlt5-base-keywords"
|
|
| 84 |
tokenizer = T5Tokenizer.from_pretrained("Voicelab/vlt5-base-keywords")
|
| 85 |
|
| 86 |
task_prefix = "Keywords: "
|
| 87 |
-
inputs = [
|
| 88 |
-
|
| 89 |
-
"
|
|
|
|
|
|
|
| 90 |
|
| 91 |
for sample in inputs:
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
|
|
|
|
|
|
| 97 |
|
| 98 |
```
|
| 99 |
# Inference
|
|
|
|
| 84 |
tokenizer = T5Tokenizer.from_pretrained("Voicelab/vlt5-base-keywords")
|
| 85 |
|
| 86 |
task_prefix = "Keywords: "
|
| 87 |
+
inputs = [
|
| 88 |
+
"Christina Katrakis, who spoke to the BBC from Vorokhta in western Ukraine, relays the account of one family, who say Russian soldiers shot at their vehicles while they were leaving their village near Chernobyl in northern Ukraine. She says the cars had white flags and signs saying they were carrying children.",
|
| 89 |
+
"Decays the learning rate of each parameter group by gamma every step_size epochs. Notice that such decay can happen simultaneously with other changes to the learning rate from outside this scheduler. When last_epoch=-1, sets initial lr as lr.",
|
| 90 |
+
"Hello, I'd like to order a pizza with salami topping.",
|
| 91 |
+
]
|
| 92 |
|
| 93 |
for sample in inputs:
|
| 94 |
+
input_sequences = [task_prefix + sample]
|
| 95 |
+
input_ids = tokenizer(
|
| 96 |
+
input_sequences, return_tensors="pt", truncation=True
|
| 97 |
+
).input_ids
|
| 98 |
+
output = model.generate(input_ids, no_repeat_ngram_size=3, num_beams=4)
|
| 99 |
+
predicted = tokenizer.decode(output[0], skip_special_tokens=True)
|
| 100 |
+
print(sample, "\n --->", predicted)
|
| 101 |
|
| 102 |
```
|
| 103 |
# Inference
|