1from transformers import AutoTokenizer, AutoModelForCausalLM
2
3model_id = "haebo/meow-clovax-v1"
4tokenizer = AutoTokenizer.from_pretrained(model_id)
5model = AutoModelForCausalLM.from_pretrained(model_id)
6
7content = "짜증났겠네 나도 아침마다 짜증남"
8emotion = "angry"
9post_type = "cat"
10instruction = f"다음 문장을 {post_type}의 {emotion}한 말투로 바꿔줘."
11
12prompt = (
13 f"### Instruction:\n{example['instruction']}\n"
14 f"### Input:\n{example['input']}\n"
15 f"### Output:\n{example['output']}"
16)
17
18inputs = tokenizer(prompt, return_tensors="pt")
19outputs = model.generate(**inputs, max_new_tokens=400)
20print(tokenizer.decode(outputs[0], skip_special_tokens=True))
-
데이터 구조
각 샘플은 아래와 같은 필드로 구성되어 있습니다.
content: 원본 문장 (일상 한국어)
emotion: 감정 레이블 (예: happy, sad, angry 등)
post_type: 동물 유형 (예: cat, dog)
transformed_content: 감정 및 동물 말투로 변환된 문장
-
예시
1{
2 "content": "오늘 점심 뭐 먹지.",
3 "emotion": "normal",
4 "post_type": dog",
5 "transformed_content": "오늘 점심 뭐 먹지멍? 🐾 맛있는 냄새가 나는 것 같다멍! 주인님, 저 밥 어딨냐왈! 빨리 밥그릇 채워달라멍! 🦴 ᓚ₍´ ꒳ `₎ა"
6}