🚀 WebOrganizer/FormatClassifier
FormatClassifier 基於網頁的 URL 和文本內容,將網頁內容組織成 24 個類別,為網頁內容的分類整理提供了高效的解決方案。
🚀 快速開始
FormatClassifier 基於網頁的 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 萬份文檔(第二階段訓練)
[論文] [網站] [GitHub]
所有領域分類器
💻 使用示例
基礎用法
此分類器期望輸入採用以下格式:
{url}
{text}
示例代碼如下:
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("WebOrganizer/FormatClassifier")
model = AutoModelForSequenceClassification.from_pretrained(
"WebOrganizer/FormatClassifier",
trust_remote_code=True,
use_memory_efficient_attention=False)
web_page = """http://www.example.com
How to make a good sandwich? [Click here to read article]"""
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
):
- 學術寫作
- 內容列表
- 創意寫作
- 客戶支持
- 評論區
- 常見問題解答
- 截斷內容
- 知識文章
- 法律聲明
- 清單文章
- 新聞文章
- 非虛構寫作
- 關於(組織)
- 新聞(組織)
- 關於(個人)
- 個人博客
- 產品頁面
- 問答論壇
- 垃圾郵件/廣告
- 結構化數據
- 文檔
- 音頻轉錄
- 教程
- 用戶評價
這些類別的完整定義可在 分類法配置 中找到。
高級用法
高效推理
我們建議你通過啟用無填充和內存高效注意力機制來使用高效的 gte-base-en-v1.5 實現。這 需要安裝 xformers
(更多信息請見 此處),並按如下方式加載模型:
AutoModelForSequenceClassification.from_pretrained(
"WebOrganizer/FormatClassifier",
trust_remote_code=True,
unpad_inputs=True,
use_memory_efficient_attention=True,
torch_dtype=torch.bfloat16
)
📚 詳細文檔
屬性 |
詳情 |
庫名稱 |
transformers |
數據集 |
WebOrganizer/FormatAnnotations-Llama-3.1-8B、WebOrganizer/FormatAnnotations-Llama-3.1-405B-FP8 |
基礎模型 |
Alibaba-NLP/gte-base-en-v1.5 |
📄 許可證
引用
如果你使用了該模型,請引用以下論文:
@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}
}