zwd973-deepseek
commited on
Commit
•
487c5e7
1
Parent(s):
d023728
update readme
Browse files
README.md
CHANGED
@@ -1,3 +1,48 @@
|
|
1 |
---
|
2 |
-
license:
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 MoE
|
17 |
+
|
18 |
+
|
19 |
+
### 2. How to Use
|
20 |
+
Here give some examples of how to use our model.
|
21 |
+
#### Text Completion
|
22 |
+
```python
|
23 |
+
import torch
|
24 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM, GenerationConfig
|
25 |
+
|
26 |
+
model_name = "deepseek-ai/deepseek-moe-16b-base"
|
27 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
28 |
+
model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype=torch.bfloat16, device_map="auto")
|
29 |
+
model.generation_config = GenerationConfig.from_pretrained(model_name)
|
30 |
+
model.generation_config.pad_token_id = model.generation_config.eos_token_id
|
31 |
+
|
32 |
+
text = "An attention function can be described as mapping a query and a set of key-value pairs to an output, where the query, keys, values, and output are all vectors. The output is"
|
33 |
+
inputs = tokenizer(text, return_tensors="pt")
|
34 |
+
outputs = model.generate(**inputs.to(model.device), max_new_tokens=100)
|
35 |
+
|
36 |
+
result = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
37 |
+
print(result)
|
38 |
+
```
|
39 |
+
|
40 |
+
### 3. License
|
41 |
+
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.
|
42 |
+
|
43 |
+
See the [LICENSE-MODEL](https://github.com/deepseek-ai/DeepSeek-MoE/blob/main/LICENSE-MODEL) for more details.
|
44 |
+
|
45 |
+
### 4. Contact
|
46 |
+
|
47 |
+
If you have any questions, please raise an issue or contact us at [[email protected]](mailto:[email protected]).
|
48 |
+
|