Kendamarron commited on
Commit
2741e42
·
verified ·
1 Parent(s): 7c97d05

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +26 -0
README.md ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - ja
5
+ pipeline_tag: text-classification
6
+ ---
7
+ [HuggingFaceFW/fineweb-edu-classifier](https://huggingface.co/HuggingFaceFW/fineweb-edu-classifier)を再現するために、日本語データで[tohoku-nlp/bert-base-japanese-v3](https://huggingface.co/tohoku-nlp/bert-base-japanese-v3)を学習したモデルです。
8
+
9
+ 学習データは、[oscar-corpus/OSCAR-2301](https://huggingface.co/datasets/oscar-corpus/OSCAR-2301)の日本語サブセットから抽出した16913個の文書に対して、[TheBloke/Mixtral-8x7B-Instruct-v0.1-GGUF](https://huggingface.co/TheBloke/Mixtral-8x7B-Instruct-v0.1-GGUF)のQ3_Kを使ってスコアリングしたものを使用しています。
10
+ 詳細: [https://zenn.dev/kendama/articles/aba63f14f88e6e](https://zenn.dev/kendama/articles/aba63f14f88e6e)
11
+ コード: [https://github.com/kkendama/fineweb-edu-classifier-ja](https://github.com/kkendama/fineweb-edu-classifier-ja)
12
+ ## 使い方
13
+ ```python
14
+ from transformers import AutoTokenizer, AutoModelForSequenceClassification
15
+ tokenizer = AutoTokenizer.from_pretrained("Kendamarron/fineweb-edu-classifier-ja-v2")
16
+ model = AutoModelForSequenceClassification.from_pretrained("Kendamarron/fineweb-edu-classifier-ja-v2")
17
+ def predict(text):
18
+ inputs = tokenizer(text, return_tensors="pt")
19
+ outputs = model(**inputs)
20
+ logits = outputs.logits
21
+ predicted_class = torch.argmax(logits, dim=-1).item()
22
+ return predicted_class
23
+ text = "富士山は、日本で最も有名な山であり、日本全土にわたる広大な自然公園の一つです。高さは3,776メートルで、日本で最も高い山です。富士山は、東京都、静岡県、山梨県の3つの県にまたがっています。"
24
+ print(predict(text))
25
+ # >> 2
26
+ ```