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