🚀 StyleDistance 风格嵌入模型
StyleDistance 是一个 风格嵌入模型,旨在将具有相似写作风格的文本紧密嵌入,而将不同风格的文本嵌入得相距较远,且不受内容影响。该模型可用于文本的风格分析、聚类、作者身份识别与验证任务,以及自动风格迁移评估。
🚀 快速开始
本仓库包含在 StyleDistance: Stronger Content-Independent Style Embeddings with Synthetic Parallel Examples 中介绍的模型。
✨ 主要特性
StyleDistance 是一种风格嵌入模型,能够将具有相似写作风格的文本紧密嵌入,而将不同风格的文本嵌入得相距较远,不受内容的影响。该模型可用于文本的风格分析、聚类、作者身份识别和验证任务,以及自动风格迁移评估。
📦 安装指南
暂未提供安装步骤相关内容。
💻 使用示例
基础用法
from sentence_transformers import SentenceTransformer
from sentence_transformers.util import cos_sim
model = SentenceTransformer('StyleDistance/styledistance') # Load model
input = model.encode("Did you hear about the Wales wing? He'll h8 2 withdraw due 2 injuries from future competitions.")
others = model.encode(["We're raising funds 2 improve our school's storage facilities and add new playground equipment!", "Did you hear about the Wales wing? He'll hate to withdraw due to injuries from future competitions."])
print(cos_sim(input, others))
📚 详细文档
模型信息
属性 |
详情 |
基础模型 |
FacebookAI/roberta-base |
数据集 |
SynthSTEL/styledistance_training_triplets、StyleDistance/synthstel |
语言 |
en |
库名称 |
sentence-transformers |
许可证 |
mit |
任务类型 |
句子相似度 |
标签 |
datadreamer、datadreamer - 0.35.0、synthetic、sentence-transformers、feature-extraction、sentence-similarity |
示例展示
- 示例 1
- 源句子:Did you hear about the Wales wing? He'll h8 2 withdraw due 2 injuries from future competitions.
- 对比句子:
- We're raising funds 2 improve our school's storage facilities and add new playground equipment!
- Did you hear about the Wales wing? He'll hate to withdraw due to injuries from future competitions.
- 示例 2
- 源句子:You planned the DesignMeets Decades of Design event; you executed it perfectly.
- 对比句子:
- We'll find it hard to prove the thief didn't face a real threat!
- You orchestrated the DesignMeets Decades of Design gathering; you actualized it flawlessly.
- 示例 3
- 源句子:Did the William Barr maintain a commitment to allow Robert Mueller to finish the inquiry?
- 对比句子:
- Will the artist be compiling a music album, or will there be a different focus in the future?
- Did William Barr maintain commitment to allow Robert Mueller to finish inquiry?
训练数据和变体
StyleDistance 在 SynthSTEL 上进行了对比训练,这是一个合成生成的数据集,包含 40 种风格特征在文本中使用的正例和反例。通过利用这个合成数据集,StyleDistance 比目前其他风格嵌入模型能够实现更强的内容独立性。这个特定的模型是使用合成数据集和 [一个利用 Reddit 上的作者身份数据集来训练风格嵌入的真实数据集](https://aclanthology.org/2022.repl4nlp - 1.26/) 组合训练的。如需仅使用合成数据训练的版本,请查看 StyleDistance 的另一个版本。
🔧 技术细节
暂未提供技术细节相关内容。
📄 许可证
本模型使用 MIT 许可证。
📖 引用
@misc{patel2025styledistancestrongercontentindependentstyle,
title={StyleDistance: Stronger Content-Independent Style Embeddings with Synthetic Parallel Examples},
author={Ajay Patel and Jiacheng Zhu and Justin Qiu and Zachary Horvitz and Marianna Apidianaki and Kathleen McKeown and Chris Callison-Burch},
year={2025},
eprint={2410.12757},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2410.12757},
}
💰 资金支持说明
本研究部分由国家情报总监办公室(ODNI)、情报高级研究计划局(IARPA)通过 HIATUS 计划合同 #2022 - 22072200005 提供支持。本文所包含的观点和结论仅代表作者本人,不一定代表 ODNI、IARPA 或美国政府的官方政策,无论是明示还是暗示。美国政府有权为政府目的复制和分发重印本,无论其中的版权声明如何。