Text Generation
Transformers
Safetensors
Persian
mt5
text2text-generation
title-generation
nlp
persian
farsi
Instructions to use NLPclass/mt5-title-generation with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use NLPclass/mt5-title-generation with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="NLPclass/mt5-title-generation")# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("NLPclass/mt5-title-generation") model = AutoModelForSeq2SeqLM.from_pretrained("NLPclass/mt5-title-generation") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use NLPclass/mt5-title-generation with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "NLPclass/mt5-title-generation" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "NLPclass/mt5-title-generation", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/NLPclass/mt5-title-generation
- SGLang
How to use NLPclass/mt5-title-generation 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 "NLPclass/mt5-title-generation" \ --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": "NLPclass/mt5-title-generation", "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 "NLPclass/mt5-title-generation" \ --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": "NLPclass/mt5-title-generation", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use NLPclass/mt5-title-generation with Docker Model Runner:
docker model run hf.co/NLPclass/mt5-title-generation
Update README.md
Browse filesChange to text-generation text2text-generation for run pipeline correctly.
README.md
CHANGED
|
@@ -72,7 +72,7 @@ print(generated_title)
|
|
| 72 |
|
| 73 |
|
| 74 |
# Create a text generation pipeline
|
| 75 |
-
title_generation_pipeline = pipeline("
|
| 76 |
generated_title = title_generation_pipeline(input_text, max_length=50, num_beams=5, early_stopping=True)
|
| 77 |
print(generated_title)
|
| 78 |
|
|
|
|
| 72 |
|
| 73 |
|
| 74 |
# Create a text generation pipeline
|
| 75 |
+
title_generation_pipeline = pipeline("text2text-generation", model="NLPclass/mt5-title-generation")
|
| 76 |
generated_title = title_generation_pipeline(input_text, max_length=50, num_beams=5, early_stopping=True)
|
| 77 |
print(generated_title)
|
| 78 |
|