Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: mit
|
3 |
+
datasets:
|
4 |
+
- nsmc
|
5 |
+
- skt/kobest_v1
|
6 |
+
- jason9693/APEACH
|
7 |
+
- kor_nlu
|
8 |
+
- klue
|
9 |
+
- KETI-AIR/korquad
|
10 |
+
language:
|
11 |
+
- ko
|
12 |
+
pipeline_tag: text-classification
|
13 |
+
---
|
14 |
+
# 아주대학교 제로샷 score model
|
15 |
+
`[CLS] 입력 정보 [SEP] 지시문 [SEP] 라벨 [SEP]` 형태의 텍스트를 모델에 넣으면, 모델이 세 텍스트의 관계를 파악하고 점수를 반환합니다. 점수가 높을 수록, 라벨이 지시문을 잘 따르는 결과임을 의미합니다. 다음과 같은 사례에 사용이 가능합니다.
|
16 |
+
|
17 |
+
1. 제로샷 분류(주제 분류, 혐오 분류)
|
18 |
+
2. 데이터 필터링(~에 대한 글인가요? 예/아니오)
|
19 |
+
|
20 |
+
[space demo](https://huggingface.co/spaces/iknow-lab/azou)에서 모델을 직접 사용해보세요!
|
21 |
+
|
22 |
+
|
23 |
+
# 사용 예시
|
24 |
+
```
|
25 |
+
# Load model directly
|
26 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
27 |
+
|
28 |
+
tokenizer = AutoTokenizer.from_pretrained("iknow-lab/azou")
|
29 |
+
model = AutoModelForSequenceClassification.from_pretrained("iknow-lab/ko-flan-zero-v0-0731")
|
30 |
+
|
31 |
+
def inference(instruction, input, labels):
|
32 |
+
instruction = f"{input} [SEP] {instruction}"
|
33 |
+
inputs = tokenizer([instruction] * len(labels), labels, truncation=True, padding=True, return_tensors="pt")
|
34 |
+
|
35 |
+
scores = model(**inputs).logits.squeeze(1).tolist()
|
36 |
+
output = dict(zip(labels, scores))
|
37 |
+
|
38 |
+
print(instruction, output)
|
39 |
+
|
40 |
+
inference(
|
41 |
+
"문장을 감성분류해주세요",
|
42 |
+
"아 영화 개노잼",
|
43 |
+
["긍정적", "부정적"]
|
44 |
+
)
|
45 |
+
|
46 |
+
inference(
|
47 |
+
"글과 관련된 내용을 만들어주세요",
|
48 |
+
"예전에는 주말마다 극장에 놀러갔는데 요새는 좀 안가는 편이에요",
|
49 |
+
["영화에 관한 글이다", "드라마에 관한 글입니다"]
|
50 |
+
)
|
51 |
+
|
52 |
+
|
53 |
+
inference(
|
54 |
+
"글을 읽고 시장에 미칠 영향을 판단해보세요",
|
55 |
+
"""인천발 KTX와 관련한 송도역 복합환승센터가 사실상 무산, 단순 철도·버스 위주 환승시설로 만들어진다. 이 때문에 인천시의 인천발 KTX 기점에 앵커시설인 복합환승센터를 통한 인근 지역 경제 활성화를 이뤄낸다는 계획의 차질이 불가피하다.
|
56 |
+
|
57 |
+
25일 시에 따르면 연수구 옥련동 104 일대 29만1천725㎡(8만8천평)에 추진 중인 2만8천62가구 규모의 송도역세권구역 도시개발사업과 연계, KTX 송도역 복합환승센터와 상업시설·업무시설 등의 조성을 추진 중이다. """,
|
58 |
+
["긍정", "부정", "중립"]
|
59 |
+
)
|
60 |
+
|
61 |
+
```
|
62 |
+
|
63 |
+
4epoch 성능 (accuracy)
|
64 |
+
|task|win|
|
65 |
+
|---|---|
|
66 |
+
|nsmc|0.8742|
|
67 |
+
|apeach|0.8326|
|
68 |
+
|klue-ynat|0.8208|
|
69 |
+
|kobest-boolq|0.896|
|
70 |
+
|kobest-copa|0.709|
|
71 |
+
|kobest-hellaswag|0.764|
|
72 |
+
|kobest-sentineg|0.9219|
|
73 |
+
|kobest-wic|0.7984|
|
74 |
+
|
75 |
+
## 학습에 사용된 데이터
|