Improve language tag
#1
by
lbourdois
- opened
README.md
CHANGED
|
@@ -1,124 +1,135 @@
|
|
| 1 |
-
---
|
| 2 |
-
datasets:
|
| 3 |
-
- ZhenghanYU/CFunSet
|
| 4 |
-
language:
|
| 5 |
-
-
|
| 6 |
-
-
|
| 7 |
-
|
| 8 |
-
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
CFunModel
|
| 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 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
)
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 124 |
🎉 **Happy Experimenting with CFunSet!** 🎉
|
|
|
|
| 1 |
+
---
|
| 2 |
+
datasets:
|
| 3 |
+
- ZhenghanYU/CFunSet
|
| 4 |
+
language:
|
| 5 |
+
- zho
|
| 6 |
+
- eng
|
| 7 |
+
- fra
|
| 8 |
+
- spa
|
| 9 |
+
- por
|
| 10 |
+
- deu
|
| 11 |
+
- ita
|
| 12 |
+
- rus
|
| 13 |
+
- jpn
|
| 14 |
+
- kor
|
| 15 |
+
- vie
|
| 16 |
+
- tha
|
| 17 |
+
- ara
|
| 18 |
+
base_model:
|
| 19 |
+
- Qwen/Qwen2.5-7B-Instruct
|
| 20 |
+
---
|
| 21 |
+
# CFunModel: A Comprehensive Language Model for Chinese Humor Understanding and Generation
|
| 22 |
+
|
| 23 |
+
CFunModel is a comprehensive language model designed for Chinese humor understanding, generation, and processing. Built on top of **Qwen2.5-7B-Instruct**, CFunModel is fine-tuned on **CFunSet**, a diverse multi-task dataset that aggregates various Chinese humor-related tasks.
|
| 24 |
+
|
| 25 |
+
CFunModel outperforms several existing large language models in humor-related tasks, including joke generation, humor recognition, crosstalk response selection, and humor explanation, etc.
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
### 🔥 Key Features
|
| 29 |
+
- 🎭 **Multi-Task Capability:** Supports joke generation, humor recognition, crosstalk continuation, humor explanation, and more.
|
| 30 |
+
- 📚 **Extensive Fine-Tuning:** Trained on over **160,000+** humor-related samples aggregated from Tieba-JokeBar, CrossDial, Chumor, HumorWB, and other datasets.
|
| 31 |
+
- 🎯 **High Performance:** Consistently achieves superior results in humor tasks compared to baseline models like GPT-4o, DeepSeek-V3, and Qwen2.5-7B-Instruct.
|
| 32 |
+
- 🧠 **Understanding and Generation:** Excels at generating humorous responses, explaining humor, and classifying humorous content.
|
| 33 |
+
|
| 34 |
+
## 🎯 Supported Tasks
|
| 35 |
+
|
| 36 |
+
CFunModel is capable of solving a variety of humor-related tasks, here are several examples:
|
| 37 |
+
|
| 38 |
+
### 1. **Joke Continuation**
|
| 39 |
+
- **Prompt:** 我将给你笑话的第一句话,请你生成整个笑话。笑话的第一句话如下:
|
| 40 |
+
- **Input:** 我对女儿说:再看10分钟的动画片就该睡觉了。
|
| 41 |
+
- **Output:** 她抗议说时间太短。“那就600秒,够长了吧?”我说。女儿说:“够了,够了。”
|
| 42 |
+
|
| 43 |
+
### 2. **Crosstalk Response Selection**
|
| 44 |
+
- **Prompt:** 给定一段相声台词,请从多个备选项中选择最合适的逗哏回复。
|
| 45 |
+
- **Input:** 已有台词:我是肖飞。|噢。|给大家说一段。|好。|吃五谷杂粮没有不得病的。|是。|我是大病上医院,小病上药店。|小病干嘛不找大夫呀?|挂号费够买药的了。|噢。
|
| 46 |
+
候选回复:早上天还没亮,三狗屁就来到了工程队。
|
| 47 |
+
反正很重,去买药,下台阶儿。
|
| 48 |
+
那天我脚气犯了,上药店买点儿药吧。
|
| 49 |
+
都快半夜了,上哪找药店去?
|
| 50 |
+
- **Output:** 那天我脚气犯了,上药店买点儿药吧。
|
| 51 |
+
|
| 52 |
+
### 3. **Humor Recognition**
|
| 53 |
+
- **Prompt:** 以下是一段文本,请分析它是否具有幽默性。幽默性指该文本是否可能引起读者发笑,或通过语言技巧(如双关语、讽刺、夸张、荒诞或逻辑上的意外)营造幽默效果。只需要输出“幽默”或“不幽默”。
|
| 54 |
+
- **Input:** 问一下已经步入社会的大人们,假如有机会带着现在的记忆回到高一那年,你最想做什么?
|
| 55 |
+
- **Output:** 不幽默
|
| 56 |
+
|
| 57 |
+
### 4. **Joke Continuation**
|
| 58 |
+
- **Prompt:** 生成一个关键词为“砍价”的笑话。
|
| 59 |
+
- **Input:** -
|
| 60 |
+
- **Output:** 老板:一块五一斤。|我:太贵了,五块钱三斤吧。|老板:不行不行。
|
| 61 |
+
|
| 62 |
+
### 5. **Crosstalk Continuation**
|
| 63 |
+
- **Prompt:** 以下是一段相声的前一半内容,请你根据给定的部分续写完成这段相声。
|
| 64 |
+
- **Input:** 0:“常言道,��酒不分家。来,抽一根儿!”|1:“你小子真鬼,用你的孬烟换我的好酒!”|0:“吝啬鬼,你能喝什么好酒?”|1:“谁不知道你呀,犯了瘾十烟屁股吸。”|0:“你馋的不要脸,蹭人家的酒喝。”
|
| 65 |
+
- **Output:** 1:“你讨厌讨厌真讨厌,公共场合放毒烟;害人害己害环境,吞云吐雾造污染。浪费开支烧金钱,口干舌燥得咽炎;慢性自杀损寿命,戒烟戒烟快戒烟!”|0:“你混蛋混蛋真混蛋,一喝就高吐一滩;伤头伤胃伤心肝,醉生梦死早完蛋……”|1:“你完蛋!”|0:“你完蛋!”|1:“你是烟鬼,你滚蛋!”
|
| 66 |
+
|
| 67 |
+
---
|
| 68 |
+
|
| 69 |
+
### 📊 Model Performance
|
| 70 |
+
|
| 71 |
+
CFunModel consistently achieves high performance across multiple humor-related tasks. Below is a performance comparison of CFunModel with other state-of-the-art models:
|
| 72 |
+
|
| 73 |
+
| **Model** | **Dougen Response (Acc)** | **Penggen Response (Acc)** | **HumorWB (Acc)** |
|
| 74 |
+
|------------------------|----------------------------|-----------------------------|-------------------|
|
| 75 |
+
| GPT-4o | 79.67 | 73.88 | 83.41 |
|
| 76 |
+
| GPT-4o mini | 74.14 | 67.45 | 84.78 |
|
| 77 |
+
| DeepSeek-V3 | 83.66 | 78.16 | 85.15 |
|
| 78 |
+
| Qwen2.5-7B-Instruct | 24.74 | 20.87 | 79.56 |
|
| 79 |
+
| ERNIE | 84.54 | - | - |
|
| 80 |
+
| RoBERTa | - | 76.19 | - |
|
| 81 |
+
| **CFunModel (Ours)** | **91.70** | **88.99** | **85.98** |
|
| 82 |
+
|
| 83 |
+
✅ CFunModel significantly improves on the base model, especially in humor-related tasks, showcasing superior performance and understanding.
|
| 84 |
+
|
| 85 |
+
---
|
| 86 |
+
### Quickstart
|
| 87 |
+
|
| 88 |
+
Here provides a code similar with the structure of Qwen2.5-7B-Instruct to show you how to use CFunModel to generate humor-related answers.
|
| 89 |
+
|
| 90 |
+
```python
|
| 91 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 92 |
+
model_name = "Qwen/Qwen2.5-7B-Instruct"
|
| 93 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 94 |
+
model_name,
|
| 95 |
+
torch_dtype="auto",
|
| 96 |
+
device_map="auto"
|
| 97 |
+
)
|
| 98 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 99 |
+
prompt = "生成一个主题为家庭琐事的笑话。"
|
| 100 |
+
messages = [
|
| 101 |
+
{"role": "system", "content": "You are a helpful assistant."},
|
| 102 |
+
{"role": "user", "content": prompt}
|
| 103 |
+
]
|
| 104 |
+
text = tokenizer.apply_chat_template(
|
| 105 |
+
messages,
|
| 106 |
+
tokenize=False,
|
| 107 |
+
add_generation_prompt=True
|
| 108 |
+
)
|
| 109 |
+
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
|
| 110 |
+
generated_ids = model.generate(
|
| 111 |
+
**model_inputs,
|
| 112 |
+
max_new_tokens=512
|
| 113 |
+
)
|
| 114 |
+
generated_ids = [
|
| 115 |
+
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
|
| 116 |
+
]
|
| 117 |
+
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
| 118 |
+
```
|
| 119 |
+
|
| 120 |
+
## 🤝 Citation
|
| 121 |
+
|
| 122 |
+
If you use CFunModel in your research or applications, please cite:
|
| 123 |
+
```
|
| 124 |
+
@misc{yu2025cfunmodelfunnylanguagemodel,
|
| 125 |
+
title={CFunModel: A "Funny" Language Model Capable of Chinese Humor Generation and Processing},
|
| 126 |
+
author={Zhenghan Yu and Xinyu Hu and Xiaojun Wan},
|
| 127 |
+
year={2025},
|
| 128 |
+
eprint={2503.20417},
|
| 129 |
+
archivePrefix={arXiv},
|
| 130 |
+
primaryClass={cs.CL},
|
| 131 |
+
url={https://arxiv.org/abs/2503.20417}, }
|
| 132 |
+
```
|
| 133 |
+
|
| 134 |
+
|
| 135 |
🎉 **Happy Experimenting with CFunSet!** 🎉
|