You need to agree to share your contact information to access this model

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

Log in or Sign Up to review the conditions and access this model content.

YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

classifier_train

在 MoLab(GPU)上,用 Nemotron-3-Embed-1B 把文章轉向量,再訓練 A/B/C 三類的 classifier head。

兩步驟

embed.py       文章 → Nemotron encode_document → 向量 .npz(算一次、快取)
train_head.py  向量 → class-weighted MLP → 在 val 選最佳 → test 報 macro-F1 / 混淆矩陣

執行(在 MoLab)

pip install -r requirements.txt
export HF_TOKEN=hf_xxx          # 讀你的私人資料集用

# 1) 轉向量(先做完全共識)
python embed.py --repo-id <你的HF帳號>/finepdfs-classifier-raw --config full_consensus

# 2) 訓練 head(先跑線性探針當 baseline,再試 MLP)
python train_head.py --config full_consensus --linear     # baseline
python train_head.py --config full_consensus              # 一層 MLP(預設 hidden=256)

產出

檔案 說明
embeddings/<config>/{train,validation,test}.npz 向量(float16 [N,2048]) + label_group + id
head.pt 驗證集 macro-F1 最佳的 head 權重

重點與可調參數

  • 模型規格:2048 維、max 32768 tokens、average pooling、輸出已 L2 normalize。全部文章走 encode_document(自動加 passage: prefix),train/inference 一致。
  • --max-seq(embed):預設 8192 截斷,兼顧速度/記憶體(品質訊號多在前段);要吃滿長文可設到 32768。
  • --batch-size(embed):OOM 就調小;Pro6000 短文本可調大。
  • --class-weight(train):預設 balanced(依訓練集反頻率,約 A0.36 / B10.8 / C6.5);也可 none 或自訂 0.36,10.78,6.47
  • 看哪個指標:極度不平衡,只看 macro-F1 / per-class recall / 混淆矩陣,別看 accuracy。

之後可以做

  • 擴充資料:--config partial_consensus 也轉向量,與 full 合併訓練。
  • baseline 不夠好:改 focal loss、對 A 類 undersample、在 val 上掃決策 threshold。
  • 再不夠:對 Nemotron 做 LoRA 端到端微調(此時向量不能預先快取)。
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support