Text Generation
Transformers
PyTorch
Safetensors
English
t5
text2text-generation
text-generation-inference
Instructions to use humarin/chatgpt_paraphraser_on_T5_base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use humarin/chatgpt_paraphraser_on_T5_base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="humarin/chatgpt_paraphraser_on_T5_base")# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("humarin/chatgpt_paraphraser_on_T5_base") model = AutoModelForSeq2SeqLM.from_pretrained("humarin/chatgpt_paraphraser_on_T5_base") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use humarin/chatgpt_paraphraser_on_T5_base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "humarin/chatgpt_paraphraser_on_T5_base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "humarin/chatgpt_paraphraser_on_T5_base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/humarin/chatgpt_paraphraser_on_T5_base
- SGLang
How to use humarin/chatgpt_paraphraser_on_T5_base 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 "humarin/chatgpt_paraphraser_on_T5_base" \ --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": "humarin/chatgpt_paraphraser_on_T5_base", "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 "humarin/chatgpt_paraphraser_on_T5_base" \ --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": "humarin/chatgpt_paraphraser_on_T5_base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use humarin/chatgpt_paraphraser_on_T5_base with Docker Model Runner:
docker model run hf.co/humarin/chatgpt_paraphraser_on_T5_base
metadata
license: openrail
datasets:
- humarin/chatgpt-paraphrases
language:
- en
library_name: transformers
This model was trained on our ChatGPT paraphrase dataset.
This dataset is based on the Quora paraphrase question, texts from the SQUAD 2.0 and the CNN news dataset.
This model is based on the T5-base model. We used "transfer learning" to get our model to generate paraphrases as well as ChatGPT. Now we can say that this is one of the best paraphrases of the Hugging Face.
Kaggle link
Deploying example:
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
device = "cuda"
tokenizer = AutoTokenizer.from_pretrained("humarin/chatgpt_paraphraser_on_T5_base")
model = AutoModelForSeq2SeqLM.from_pretrained("humarin/chatgpt_paraphraser_on_T5_base").to(device)
def paraphrase(text, max_length=128, num_return_sequences=5, num_beams=25, temperature=0.7):
input_ids = tokenizer(
f'paraphrase: {text}',
return_tensors="pt", padding="longest",
max_length=max_length,
truncation=True,
).input_ids.to(device)
outputs = model.generate(
input_ids, temperature=temperature, repetition_penalty=1.5,
num_return_sequences=num_return_sequences, no_repeat_ngram_size=5, num_beams=num_beams, max_length=max_length
)
res = tokenizer.batch_decode(outputs, skip_special_tokens=True)
return res
Usage examples
Input:
text = 'What are the best places to see in New York?'
paraphrase(text)
Output:
['What are some of the must-visit places in New York?',
'Which places should I not miss when visiting New York?',
'Which are the top tourist destinations in New York?',
'Which places should I not miss while visiting New York?',
'What are some of the must-visit locations in New York?']
Input:
text = "This Year's Model is the second studio album by the English singer-songwriter Elvis Costello (pictured), released on 17 March 1978 through Radar Records with his new backing band, the Attractions. It was recorded at Eden Studios in late 1977 and early 1978."
paraphrase(text)
Output:
["The English singer-songwriter Elvis Costello's second studio album, This Year's Model, was released on 17 March 1978 through Radar Records with his new backing band, the Attractions. It was recorded at Eden Studios in late 1977 and early 1978.",
"This Year's Model, the second studio album of Elvis Costello (pictured), was released on 17 March 1978 through Radar Records with his new backing band, the Attractions. It was recorded at Eden Studios in late 1977 and early 1978.",
"The English singer-songwriter Elvis Costello's second studio album, This Year's Model, was released on March 17, 1978, through Radar Records with his new backing band, the Attractions. It was recorded at Eden Studios in late 1977 and early 1978.",
"The English singer-songwriter Elvis Costello (pictured) released his second studio album, This Year's Model, on 17 March 1978 through Radar Records with his new backing band, the Attractions, which was recorded at Eden Studios in late 1977 and early 1978.",
"The English singer-songwriter Elvis Costello (pictured) released his second studio album, This Year's Model, on March 17, 1978, through Radar Records with his new backing band, the Attractions. It was recorded at Eden Studios in late 1977 and early 1978."]
Train parameters:
epochs = 1
batch_size = 128
lr = 5e-5
batches_qty = 82849
betas = (0.9, 0.999)
eps = 1e-08