Text Generation
Transformers
PyTorch
English
t5
text2text-generation
paraphrase-generation
Conditional Generation
text-generation-inference
Instructions to use shrishail/t5_paraphrase_msrp_paws with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use shrishail/t5_paraphrase_msrp_paws with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="shrishail/t5_paraphrase_msrp_paws")# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("shrishail/t5_paraphrase_msrp_paws") model = AutoModelForSeq2SeqLM.from_pretrained("shrishail/t5_paraphrase_msrp_paws") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use shrishail/t5_paraphrase_msrp_paws with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "shrishail/t5_paraphrase_msrp_paws" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "shrishail/t5_paraphrase_msrp_paws", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/shrishail/t5_paraphrase_msrp_paws
- SGLang
How to use shrishail/t5_paraphrase_msrp_paws 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 "shrishail/t5_paraphrase_msrp_paws" \ --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": "shrishail/t5_paraphrase_msrp_paws", "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 "shrishail/t5_paraphrase_msrp_paws" \ --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": "shrishail/t5_paraphrase_msrp_paws", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use shrishail/t5_paraphrase_msrp_paws with Docker Model Runner:
docker model run hf.co/shrishail/t5_paraphrase_msrp_paws
Simple model for Paraphrase Generation
โ
Model description
โ T5-based model for generating paraphrased sentences. It is trained on the labeled MSRP and Google PAWS dataset. โ
How to use
โ
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
tokenizer = AutoTokenizer.from_pretrained("shrishail/t5_paraphrase_msrp_paws")
model = AutoModelForSeq2SeqLM.from_pretrained("shrishail/t5_paraphrase_msrp_paws")
โ
sentence = "This is something which i cannot understand at all"
text = "paraphrase: " + sentence + " </s>"
encoding = tokenizer.encode_plus(text,pad_to_max_length=True, return_tensors="pt")
input_ids, attention_masks = encoding["input_ids"].to("cuda"), encoding["attention_mask"].to("cuda")
outputs = model.generate(
input_ids=input_ids, attention_mask=attention_masks,
max_length=256,
do_sample=True,
top_k=120,
top_p=0.95,
early_stopping=True,
num_return_sequences=5
)
for output in outputs:
line = tokenizer.decode(output, skip_special_tokens=True,clean_up_tokenization_spaces=True)
print(line)
โ
- Downloads last month
- 4