Update README.md
Browse files
README.md
CHANGED
@@ -14,3 +14,27 @@ japanese-sexual-moderationは、[studio-ousia/luke-japanese-large-lite](https://
|
|
14 |
このモデルは[japanese-llm-roleplay-benchmark](https://github.com/oshizo/japanese-llm-roleplay-benchmark)でのERPスコアを算出するために作成されました。
|
15 |
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
このモデルは[japanese-llm-roleplay-benchmark](https://github.com/oshizo/japanese-llm-roleplay-benchmark)でのERPスコアを算出するために作成されました。
|
15 |
|
16 |
|
17 |
+
## Usage
|
18 |
+
|
19 |
+
```python
|
20 |
+
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
21 |
+
import numpy as np
|
22 |
+
|
23 |
+
scoring_model_id = "oshizo/japanese-sexual-moderation"
|
24 |
+
|
25 |
+
tokenizer = AutoTokenizer.from_pretrained(scoring_model_id)
|
26 |
+
model = AutoModelForSequenceClassification.from_pretrained(
|
27 |
+
scoring_model_id,
|
28 |
+
problem_type="multi_label_classification",
|
29 |
+
num_labels=1
|
30 |
+
)
|
31 |
+
|
32 |
+
text = "富士山は日本で一番高い山です。"
|
33 |
+
with torch.no_grad():
|
34 |
+
encoding = tokenizer(text, return_tensors="pt")
|
35 |
+
score = model(**encoding).logits
|
36 |
+
|
37 |
+
# tensor([[-2.7863]])
|
38 |
+
|
39 |
+
```
|
40 |
+
|