🚀 WebOrganizer/TopicClassifier-NoURL
WebOrganizer/TopicClassifier-NoURL 是一个基于网页文本内容(不使用 URL 信息)将网页内容划分为 17 个类别的分类器,为网页内容的组织和分类提供了高效的解决方案。
[论文] [网站] [GitHub]
✨ 主要特性
- 精准分类:基于网页文本内容,将网页精准划分为 17 个类别。
- 高效模型:采用 gte-base-en-v1.5 模型,参数为 140M,经过精心微调。
- 多阶段训练:使用不同数据集进行两阶段训练,提升模型性能。
📦 安装指南
文档未提及安装步骤,跳过此章节。
💻 使用示例
基础用法
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("WebOrganizer/TopicClassifier-NoURL")
model = AutoModelForSequenceClassification.from_pretrained(
"WebOrganizer/TopicClassifier-NoURL",
trust_remote_code=True,
use_memory_efficient_attention=False)
web_page = """How to build a computer from scratch? Here are the components you need..."""
inputs = tokenizer([web_page], return_tensors="pt")
outputs = model(**inputs)
probs = outputs.logits.softmax(dim=-1)
print(probs.argmax(dim=-1))
高级用法
AutoModelForSequenceClassification.from_pretrained(
"WebOrganizer/TopicClassifier-NoURL",
trust_remote_code=True,
unpad_inputs=True,
use_memory_efficient_attention=True,
torch_dtype=torch.bfloat16
)
📚 详细文档
所有领域分类器
分类类别
模型可以将 logits
通过 softmax 转换为概率分布,涵盖以下 24 个类别(按标签顺序,也可查看模型配置中的 id2label
和 label2id
):
- 成人内容
- 艺术与设计
- 软件开发
- 犯罪与法律
- 教育与就业
- 硬件
- 娱乐
- 社交生活
- 时尚与美容
- 金融与商业
- 食品与餐饮
- 游戏
- 健康
- 历史
- 家居与爱好
- 工业
- 文学
- 政治
- 宗教
- 科学与技术
- 软件
- 体育与健身
- 交通
- 旅游
这些类别的完整定义可在 分类配置 中找到。
高效推理
建议使用高效的 gte-base-en-v1.5 实现,启用 unpadding 和内存高效注意力机制。这 需要安装 xformers
(更多信息见 此处)。
🔧 技术细节
模型信息
📄 许可证
文档未提及许可证信息,跳过此章节。
📚 引用
@article{wettig2025organize,
title={Organize the Web: Constructing Domains Enhances Pre-Training Data Curation},
author={Alexander Wettig and Kyle Lo and Sewon Min and Hannaneh Hajishirzi and Danqi Chen and Luca Soldaini},
journal={arXiv preprint arXiv:2502.10341},
year={2025}
}