🚀 关键词标题生成器
标题生成器是一款在线工具,它能帮助你为内容创建出色的标题。只需输入特定的关键词或有关内容的信息,你就能获得主题建议,从而提升内容的吸引力。该工具由 https://exnrt.com 开发。
🚀 快速开始
主要特性
- 微调模型:T5-Base
- 参数数量:2.23 亿
- 训练数据集长度:10,000
- 验证数据集长度:2,000
- 批次大小:1
- 训练轮数:2
- 训练损失:1.6578
- 验证损失:1.8115
你还可以使用位于 mini 文件夹中的 t5-small
(7700 万参数)模型。
安装指南
文档未提及安装步骤,故跳过此部分。
💻 使用示例
基础用法
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
import torch
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
tokenizer = AutoTokenizer.from_pretrained("Ateeqq/keywords-title-generator")
model = AutoModelForSeq2SeqLM.from_pretrained("Ateeqq/keywords-title-generator").to(device)
def generate_title(keywords):
input_ids = tokenizer(keywords, return_tensors="pt", padding="longest", truncation=True, max_length=24).input_ids.to(device)
outputs = model.generate(
input_ids,
num_beams=5,
num_beam_groups=5,
num_return_sequences=5,
repetition_penalty=10.0,
diversity_penalty=3.0,
no_repeat_ngram_size=2,
temperature=0.7,
max_length=24
)
return tokenizer.batch_decode(outputs, skip_special_tokens=True)
keywords = 'model, Fine-tuning, Machine Learning'
generate_title(keywords)
输出示例
['How to Fine-tune Your Machine Learning Model for Better Performance',
'Fine-tuning your Machine Learning model with a simple technique',
'Using fine tuning to fine-tune your machine learning model',
'Machine Learning: Fine-tuning your model to fit the needs of machine learning',
'The Art of Fine-Tuning Your Machine Learning Model']
🔧 技术细节
文档未提供足够详细的技术实现细节,故跳过此部分。
📄 许可证
本项目采用 Apache-2.0 许可证。
信息表格
属性 |
详情 |
模型类型 |
文本到文本生成 |
微调模型 |
T5-Base |
参数数量 |
2.23 亿 |
训练数据集长度 |
10,000 |
验证数据集长度 |
2,000 |
批次大小 |
1 |
训练轮数 |
2 |
训练损失 |
1.6578 |
验证损失 |
1.8115 |
替代模型 |
t5-small (7700 万参数,位于 mini 文件夹) |