library_name: transformers
datasets:
- WebOrganizer/FormatAnnotations-Llama-3.1-8B
- WebOrganizer/FormatAnnotations-Llama-3.1-405B-FP8
base_model:
- Alibaba-NLP/gte-base-en-v1.5
WebOrganizer/FormatClassifier-NoURL
[论文] [官网] [GitHub]
FormatClassifier-NoURL模型基于网页文本内容(不使用URL信息)将网络内容划分为24个类别。
该模型是在gte-base-en-v1.5(1.4亿参数)基础上微调而成,训练数据包括:
- WebOrganizer/FormatAnnotations-Llama-3.1-8B:由Llama-3.1-8B标注的100万文档(第一阶段训练)
- WebOrganizer/FormatAnnotations-Llama-3.1-405B-FP8:由Llama-3.1-405B-FP8标注的10万文档(第二阶段训练)
全领域分类器
使用方法
输入格式要求:
{文本内容}
示例:
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("WebOrganizer/FormatClassifier-NoURL")
model = AutoModelForSequenceClassification.from_pretrained(
"WebOrganizer/FormatClassifier-NoURL",
trust_remote_code=True,
use_memory_efficient_attention=False)
web_page = """如何制作美味三明治?[点击阅读全文]"""
inputs = tokenizer([web_page], return_tensors="pt")
outputs = model(**inputs)
probs = outputs.logits.softmax(dim=-1)
print(probs.argmax(dim=-1))
通过softmax转换模型输出的logits
,可获得以下24个类别的概率分布(标签顺序详见模型配置中的id2label
和label2id
):
- 学术写作
- 内容列表
- 创意写作
- 客户支持
- 评论区
- 常见问题
- 截断内容
- 知识文章
- 法律声明
- 清单体
- 新闻文章
- 非虚构写作
- 机构介绍
- 机构新闻
- 个人简介
- 个人博客
- 产品页面
- 问答论坛
- 垃圾广告
- 结构化数据
- 技术文档
- 音频转录
- 教程指南
- 用户评价
完整类别定义参见分类体系配置。
高效推理
建议启用去填充和内存高效注意力机制(需安装xformers
,详见说明):
AutoModelForSequenceClassification.from_pretrained(
"WebOrganizer/FormatClassifier-NoURL",
trust_remote_code=True,
unpad_inputs=True,
use_memory_efficient_attention=True,
torch_dtype=torch.bfloat16
)
引用
@article{wettig2025organize,
title={网络内容组织:领域构建增强预训练数据管理},
author={亚历山大·韦蒂格 and 凯尔·罗 and 苏文敏 and 哈纳内·哈吉希尔齐 and 陈丹琦 and 卢卡·索尔达尼},
journal={arXiv预印本 arXiv:2502.10341},
year={2025}
}