singoojiang's picture
Upload 3 files
47ed012 verified
|
Raw
History Blame Contribute Delete
1.19 kB
metadata
license: mit
pipeline_tag: text2text-generation
tags:
  - text2text-generation
  - paraphrase
  - t5
base_model: humarin/chatgpt_paraphraser_on_T5_base

humarin-paraphraser-handler

Custom HF Inference Endpoint handler that wraps humarin/chatgpt_paraphraser_on_T5_base with explicit T5ForConditionalGeneration + diverse beam search, so HF auto-routing cannot mis-load it as a causal LM.

Why this exists

When deployed directly, HF Inference Endpoints routed the base model to vLLM / TGI, which treats T5 as causal generation and produces broken output (echoes the input prompt instead of returning a paraphrase).

This repo only ships handler.py + requirements.txt; the model weights are loaded at runtime from the base repo.

API

POST with JSON body:

{
  "inputs": "The product is excellent and works well.",
  "parameters": {
    "num_beams": 5,
    "num_beam_groups": 5,
    "num_return_sequences": 5,
    "diversity_penalty": 3.0,
    "repetition_penalty": 10.0,
    "no_repeat_ngram_size": 2,
    "max_length": 128
  }
}

Returns 5 paraphrase candidates as [{"generated_text": ...}, ...].