Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: other
|
3 |
+
license_name: deepseek
|
4 |
+
license_link: LICENSE
|
5 |
+
---
|
6 |
+
|
7 |
+
<p align="center">
|
8 |
+
<img width="500px" alt="DeepSeek Chat" src="https://github.com/deepseek-ai/DeepSeek-LLM/blob/main/images/logo.png?raw=true">
|
9 |
+
</p>
|
10 |
+
<p align="center"><a href="https://www.deepseek.com/">[🏠Homepage]</a> | <a href="https://chat.deepseek.com/">[🤖 Chat with DeepSeek LLM]</a> | <a href="https://discord.gg/Tc7c45Zzu5">[Discord]</a> | <a href="https://github.com/deepseek-ai/DeepSeek-LLM/blob/main/images/qr.jpeg">[Wechat(微信)]</a> </p>
|
11 |
+
<hr>
|
12 |
+
|
13 |
+
|
14 |
+
|
15 |
+
|
16 |
+
### 1. Introduction of Deepseek LLM
|
17 |
+
|
18 |
+
Introducing DeepSeek LLM, an advanced language model comprising 7 billion parameters. It has been trained from scratch on a vast dataset of 2 trillion tokens in both English and Chinese. In order to foster research, we have made DeepSeek LLM 7B/67B Base and DeepSeek LLM 7B/67B Chat open source for the research community.
|
19 |
+
|
20 |
+
|
21 |
+
### 2. Model Summary
|
22 |
+
deepseek-llm-7b-chat is a 7B parameter model with Multi-Head Attention trained on 2 trillion tokens from scratch.
|
23 |
+
- **Home Page:** [DeepSeek](https://deepseek.com/)
|
24 |
+
- **Repository:** [deepseek-ai/deepseek-LLM](https://github.com/deepseek-ai/deepseek-LLM)
|
25 |
+
- **Chat With DeepSeek LLM:** [DeepSeek-LLM](https://chat.deepseek.com/)
|
26 |
+
|
27 |
+
|
28 |
+
### 3. How to Use
|
29 |
+
Here give some examples of how to use our model.
|
30 |
+
#### Chat Completion
|
31 |
+
```python
|
32 |
+
import torch
|
33 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM, GenerationConfig
|
34 |
+
|
35 |
+
model_name = "deepseek-ai/deepseek-llm-7b-chat"
|
36 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
37 |
+
model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype=torch.bfloat16, device_map="auto")
|
38 |
+
model.generation_config = GenerationConfig.from_pretrained(model_name)
|
39 |
+
model.generation_config.pad_token_id = model.generation_config.eos_token_id
|
40 |
+
|
41 |
+
messages = [
|
42 |
+
{"role": "user", "content": "Who are you?"}
|
43 |
+
]
|
44 |
+
input_tensor = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt")
|
45 |
+
outputs = model.generate(input_tensor.to(model.device), max_new_tokens=100)
|
46 |
+
|
47 |
+
result = tokenizer.decode(outputs[0][input_tensor.shape[1]:], skip_special_tokens=True)
|
48 |
+
print(result)
|
49 |
+
```
|
50 |
+
|
51 |
+
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.
|
52 |
+
|
53 |
+
```
|
54 |
+
User: {messages[0]['content']}
|
55 |
+
|
56 |
+
Assistant: {messages[1]['content']}<|end▁of▁sentence|>User: {messages[2]['content']}
|
57 |
+
|
58 |
+
Assistant:
|
59 |
+
```
|
60 |
+
|
61 |
+
**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.
|
62 |
+
|
63 |
+
### 4. License
|
64 |
+
This code repository is licensed under the MIT License. The use of DeepSeek LLM models is subject to the Model License. DeepSeek LLM supports commercial use.
|
65 |
+
|
66 |
+
See the [LICENSE-MODEL](https://github.com/deepseek-ai/deepseek-LLM/blob/main/LICENSE-MODEL) for more details.
|
67 |
+
|
68 |
+
### 5. Contact
|
69 |
+
|
70 |
+
If you have any questions, please raise an issue or contact us at [[email protected]](mailto:[email protected]).
|
71 |
+
|