Downloads · 30 days
10
17% of all-time downloads
Kendamarron/fineweb-edu-classifier-ja-v2
fineweb-edu-classifier-ja-v2 is a text classification model from Kendamarron. Use it when you need a label for a piece of text. It is set up for transformers. The card lists the license as apache-2.0.
HuggingFaceFW/fineweb-edu-classifierを再現するために、日本語データでtohoku-nlp/bert-base-japanese-v3を学習したモデルです。
Downloads · 30 days
10
17% of all-time downloads
All-time downloads
59
Public
Parameters
111M
450 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors445 MB · 99%
From the Hugging Face model README
HuggingFaceFW/fineweb-edu-classifierを再現するために、日本語データでtohoku-nlp/bert-base-japanese-v3を学習したモデルです。
学習データは、oscar-corpus/OSCAR-2301の日本語サブセットから抽出した16913個の文書に対して、TheBloke/Mixtral-8x7B-Instruct-v0.1-GGUFのQ3_Kを使ってスコアリングしたものを使用しています。 詳細: https://zenn.dev/kendama/articles/aba63f14f88e6e コード: https://github.com/kkendama/fineweb-edu-classifier-ja
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("Kendamarron/fineweb-edu-classifier-ja-v2")
model = AutoModelForSequenceClassification.from_pretrained("Kendamarron/fineweb-edu-classifier-ja-v2")
def predict(text):
inputs = tokenizer(text, return_tensors="pt")
outputs = model(**inputs)
logits = outputs.logits
predicted_class = torch.argmax(logits, dim=-1).item()
return predicted_class
text = "富士山は、日本で最も有名な山であり、日本全土にわたる広大な自然公園の一つです。高さは3,776メートルで、日本で最も高い山です。富士山は、東京都、静岡県、山梨県の3つの県にまたがっています。"
print(predict(text))
# >> 2