File size: 3,490 Bytes
3058c0c
 
 
 
 
 
 
 
 
 
 
 
 
64c54b5
3058c0c
 
 
 
 
 
 
 
 
 
 
 
70c3457
3058c0c
48198ac
7d4dd2b
65147f0
3058c0c
48198ac
e33ab7d
48198ac
3058c0c
 
 
 
 
 
 
 
 
 
 
 
 
 
70c3457
3058c0c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70c3457
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
77
78
79
80
81
82
83
84
85
86
87
---
license: mit
language:
- zh
base_model:
- deepseek-ai/deepseek-llm-7b-chat
---
# Deep **<u>Seek</u>-<u>Fake</u>-<u>News</u>** LLM
<!-- markdownlint-disable first-line-h1 -->
<!-- markdownlint-disable html -->
<!-- markdownlint-disable no-duplicate-header -->

<div align="center">
  <img src="figures/logo_v1.0.png" width="100%" height="50%" alt="DeepSeekFakeNews-LLM" />
</div>

<p align="center">
  <a href="https://github.com/TAN-OpenLab"><b>Project Link</b>👁️</a>
  <a href="http://faculty.neu.edu.cn/tanzhenhua/zh_CN/index/100352/list/index.htm"><b>Lab Link</b>👁️</a>
</p>


### 1. Introduction of Deep **<u>Seek</u>-<u>Fake</u>-<u>News</u>** LLM

  
### 2. Model Summary
`deepseekfakenews-llm-7b-chat` is a 7B parameter model initialized from `deepseek-llm-7b-chat` and fine-tuned on extra Weibo fake news instruction data.

- **Home Page:** [DeepSeekFakeNews](https://github.com/TAN-OpenLab/DeepSeekFakeNews-LLM)
- **Repository:** [zt-ai/DeepSeekFakeNews-LLM-7B-Chat](https://huggingface.co/zt-ai/DeepSeekFakeNews-LLM-7B-Chat)
- **Demo of Chatting With DeepSeekFakeNews-LLM:

<div align="center">
  <img src="figures/demo.PNG" width="100%" alt="Chat with DeepSeekFakeNews-LLM" />
</div>

### 3. How to Use
Here are some examples of how to use our model.

```python
import torch
from peft import PeftModel
from transformers import AutoTokenizer, AutoModelForCausalLM, GenerationConfig

model_name = "zt-ai/DeepSeekFakeNews-llm-7b-chat"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)
model.generation_config = GenerationConfig.from_pretrained(model_name)
model.generation_config.pad_token_id = model.generation_config.eos_token_id
model = PeftModel.from_pretrained(model, model_name)


messages = [
    {
"role": "user",
"content":
"""假新闻的表现可以总结为以下几个方面:1. 逻辑和事实矛盾。2.断章取义和误导性信息。3.夸张标题和吸引眼球的内容。4.情绪化和极端语言。5.偏见和单一立场。请从这几个方面分析新闻的真实性(真新闻或假新闻):
发布时间:
新闻标题:
新闻内容:
"""}
]
input_tensor = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt")
outputs = model.generate(input_tensor.to(model.device), max_new_tokens=100)

result = tokenizer.decode(outputs[0][input_tensor.shape[1]:], skip_special_tokens=True)
print(result)
```

Avoiding the use of the provided function `apply_chat_template`, you can also interact with our model following the sample template. Note that `messages` should be replaced by your input.

```
User: {messages[0]['content']}

Assistant: 
```

**Note:** By default (`add_special_tokens=True`), our tokenizer automatically adds a `bos_token` (`<|begin▁of▁sentence|>`) before the input text. Additionally, since the system prompt is not compatible with this version of our models, we DO NOT RECOMMEND including the system prompt in your input.

### 4. License
This code repository is licensed under the MIT License. The use of DeepSeekFakeNews-LLM models is subject to the Model License. DeepSeekFakeNews-LLM supports commercial use.

<!-- See the [LICENSE-MODEL](https://github.com/deepseek-ai/deepseek-LLM/blob/main/LICENSE-MODEL) for more details. -->

### 5. Contact

If you have any questions, please raise an issue or contact us at [[email protected]](mailto:[email protected]) or [[email protected]](mailto:[email protected]).