YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
Mindcast SD_SC Pipeline
ํ๊ตญ์ด ํ ์คํธ๋ฅผ ์ํ ํตํฉ ๊ฐ์ ๋ถ์ ํ์ดํ๋ผ์ธ์ ๋๋ค. Sarcasm Detection๊ณผ Sentiment Classification์ ๊ฒฐํฉํ์ฌ ๋ ์ ํํ ๊ฐ์ ๋ถ์์ ์ ๊ณตํฉ๋๋ค.
๐ ํน์ง
- 2๋จ๊ณ ํ์ดํ๋ผ์ธ: Sarcasm Detection โ Sentiment Classification
- ์ํฉ๋ณ ๋ชจ๋ธ ์ฌ์ฉ: ์ผ๋ฐ ํ ์คํธ์ ๋น๊ผฌ๋ ํ ์คํธ์ ๊ฐ๊ฐ ํนํ๋ ๋ชจ๋ธ ์ ์ฉ
- 6๊ฐ์ง ๊ฐ์ ๋ถ๋ฅ: ๋ถ๋ ธ, ์ฌํ, ๋ถ์, ์์ฒ, ๋นํฉ, ๊ธฐ์จ
- ๋ฐฐ์น ์ฒ๋ฆฌ ์ง์: ์ฌ๋ฌ ํ ์คํธ ๋์ ๋ถ์
- ๋ถํฌ ๋ถ์ ๊ธฐ๋ฅ: ๊ฐ์ ๋ฐ sarcasm ๋ถํฌ ํต๊ณ
๐ ์ํฌํ๋ก์ฐ
- ์ ๋ ฅ ํ ์คํธ โ Sarcasm Detector โ Normal(0) or Sarcastic(1)
- Normal โ SC_Normal ๋ชจ๋ธ๋ก ๊ฐ์ ๋ถ๋ฅ
- Sarcastic โ SC_Sarcastic ๋ชจ๋ธ๋ก ๊ฐ์ ๋ถ๋ฅ
- ์ต์ข ๊ฐ์ ๊ฒฐ๊ณผ ๋ฐํ
๐ง ์ค์น
pip install torch transformers huggingface_hub numpy
๐ป ์ฌ์ฉ๋ฒ
๊ธฐ๋ณธ ์ฌ์ฉ
from sd_sc_pipeline import load_mindcast_pipeline
# ํ์ดํ๋ผ์ธ ๋ก๋
pipeline = load_mindcast_pipeline()
# ๋จ์ผ ํ
์คํธ ๋ถ์
text = "์ ์ง์ง ์ต๊ณ ๋ค~ ์์ ๋งํ๋ค"
result = pipeline.predict(text)
print(f"ํ
์คํธ: {text}")
print(f"Sarcasm: {result['sarcasm']['label']} ({result['sarcasm']['confidence']:.3f})")
print(f"๊ฐ์ : {result['final_emotion']} ({result['sentiment']['confidence']:.3f})")
print(f"์ฌ์ฉ ๋ชจ๋ธ: {result['sentiment']['model_used']}")
๋ฐฐ์น ๋ถ์
texts = [
"์ค๋ ์ ๋ง ๊ธฐ๋ถ์ด ์ข์์!",
"์ ์ง์ง ์ต๊ณ ๋ค~ ์์ ๋งํ๋ค",
"๋๋ฌด ์ฌํผ์ ๋๋ฌผ์ด ๋์"
]
# ๋ฐฐ์น ์์ธก
results = pipeline.predict_batch(texts)
# ๊ฐ์ ๋ถํฌ ๋ถ์
emotion_dist = pipeline.get_emotion_distribution(texts)
print("๊ฐ์ ๋ถํฌ:", emotion_dist)
# Sarcasm ๋ถํฌ ๋ถ์
sarcasm_dist = pipeline.analyze_sarcasm_distribution(texts)
print(f"Sarcastic ๋น์จ: {sarcasm_dist['sarcastic_ratio']:.1%}")
๋น ๋ฅธ ์ฌ์ฉ (Quick API)
from sd_sc_pipeline import quick_predict
emotion = quick_predict("์~ ์ ๋ง ๋๋จํ๋ค์~")
print(emotion) # ์ถ๋ ฅ: "๋ถ๋
ธ" (sarcastic context์์ ๋ถ์๋จ)
๐ค ์ฌ์ฉ๋ ๋ชจ๋ธ
- Sarcasm Detector:
merrybabyxmas/mindcast-sarcasm-detector - Normal Sentiment:
merrybabyxmas/mindcast-emotion-normal - Sarcastic Sentiment:
merrybabyxmas/mindcast-emotion-sarcastic
๐ ๊ฐ์ ๋ผ๋ฒจ
| ID | ๊ฐ์ | ์ค๋ช |
|---|---|---|
| 0 | ๋ถ๋ ธ | ํ๋จ, ์ง์ฆ, ๋ถ์พ๊ฐ |
| 1 | ์ฌํ | ์ฐ์ธ, ์ค๋ง, ์ข์ ๊ฐ |
| 2 | ๋ถ์ | ๊ฑฑ์ , ๋๋ ค์, ๊ธด์ฅ๊ฐ |
| 3 | ์์ฒ | ์์ดํจ, ๋ฐฐ์ ๊ฐ, ์ํ |
| 4 | ๋นํฉ | ๋๋, ํผ๋, ์ด๋ฆฌ๋ฅ์ |
| 5 | ๊ธฐ์จ | ํ๋ณต, ๋ง์กฑ, ์ฆ๊ฑฐ์ |
โก ์ฑ๋ฅ ์ต์ ํ
# GPU ์ฌ์ฉ
pipeline = load_mindcast_pipeline(device="cuda")
# ํน์ GPU ์ฌ์ฉ
pipeline = load_mindcast_pipeline(device="cuda:0")
# CPU ์ฌ์ฉ
pipeline = load_mindcast_pipeline(device="cpu")
๐ ํ์ผ ๊ตฌ์กฐ
โโโ sd_sc_pipeline.py # ๋ฉ์ธ ํ์ดํ๋ผ์ธ ํด๋์ค
โโโ __init__.py # ํจํค์ง ์ด๊ธฐํ
โโโ example.py # ์ฌ์ฉ ์์
โโโ pipeline_config.json # ์ค์ ํ์ผ
โโโ requirements.txt # ์์กด์ฑ ๋ชฉ๋ก
โโโ README.md # ์ด ๋ฌธ์
๐ ์์ ๊ฒฐ๊ณผ
ํ
์คํธ: ์ ์ง์ง ์ต๊ณ ๋ค~ ์์ ๋งํ๋ค
Sarcasm: Sarcastic (0.892)
๊ฐ์ : ๋ถ๋
ธ (sarcastic model, 0.856)
ํ
์คํธ: ์ค๋ ์ ๋ง ๊ธฐ๋ถ์ด ์ข์์!
Sarcasm: Non-sarcastic (0.934)
๊ฐ์ : ๊ธฐ์จ (normal model, 0.912)
๐ท๏ธ ๋ผ์ด์ผ์ค
์ด ํ์ดํ๋ผ์ธ์ ์ฐ๊ตฌ ๋ฐ ๋น์์ ์ ์ฉ๋๋ก ์ฌ์ฉ ๊ฐ๋ฅํฉ๋๋ค.
๐ค ๊ธฐ์ฌ
๋ฒ๊ทธ ๋ฆฌํฌํธ๋ ๊ฐ์ ์ ์์ Issues์์ ํ์ํฉ๋๋ค!
Mindcast Team | ํ๊ตญ์ด ๊ฐ์ ๋ถ์์ ์๋ก์ด ๊ธฐ์ค
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐ Ask for provider support