summarization

作者 ashishkat · 下载 0 · 点赞 1 · 更新 2023-11-02

### encode the input paragraph to summarize
tokenized_text = tokenizer.encode_plus(
        str(text_input),
        return_attention_mask = True, 
        return_tensors="pt")

### pass the tokenized paragraph in model
generated_token = model.generate(
        input_ids = tokenized_text["input_ids"],
        attention_mask=tokenized_text["attention_mask"],
        max_length = 256,
        use_cache=True,
         )

### decode the summarized paragraph token
summarized_paragraph = [
           tokenizer.decode(token_ids=ids, skip_special_tokens=True) for ids in generated_token
   ]

Summarized paragraph is the final result.

模型信息

该模型卡暂无预览图和文字说明。以下信息来自 Hugging Face。

作者 ashishkat
类型—
基础模型—
标签—
下载0
点赞1
更新时间2023-11-02
Hugging Face https://huggingface.co/ashishkat/summarization