sudhanshu746
commited on
Commit
•
219f3bb
1
Parent(s):
fccf703
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Quantization made by Sudhanshu Sharma.
|
2 |
+
|
3 |
+
[Github](https://github.com/sudhanshu746)
|
4 |
+
|
5 |
+
|
6 |
+
|
7 |
+
deepseek-math-7b-rl - bnb 4bits
|
8 |
+
- Model creator: https://huggingface.co/deepseek-ai/
|
9 |
+
- Original model: https://huggingface.co/deepseek-ai/deepseek-math-7b-rl/
|
10 |
+
|
11 |
+
|
12 |
+
|
13 |
+
|
14 |
+
Original model description:
|
15 |
+
---
|
16 |
+
license: other
|
17 |
+
license_name: deepseek
|
18 |
+
license_link: https://github.com/deepseek-ai/DeepSeek-Math/blob/main/LICENSE-MODEL
|
19 |
+
---
|
20 |
+
|
21 |
+
|
22 |
+
<p align="center">
|
23 |
+
<img width="500px" alt="DeepSeek Chat" src="https://github.com/deepseek-ai/DeepSeek-LLM/blob/main/images/logo.png?raw=true">
|
24 |
+
</p>
|
25 |
+
<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>
|
26 |
+
|
27 |
+
<p align="center">
|
28 |
+
<a href="https://arxiv.org/pdf/2402.03300.pdf"><b>Paper Link</b>👁️</a>
|
29 |
+
</p>
|
30 |
+
|
31 |
+
<hr>
|
32 |
+
|
33 |
+
|
34 |
+
|
35 |
+
|
36 |
+
|
37 |
+
### 1. Introduction to DeepSeekMath
|
38 |
+
See the [Introduction](https://github.com/deepseek-ai/DeepSeek-Math) for more details.
|
39 |
+
|
40 |
+
### 2. How to Use
|
41 |
+
Here give some examples of how to use our model.
|
42 |
+
|
43 |
+
**Chat Completion**
|
44 |
+
|
45 |
+
❗❗❗ **Please use chain-of-thought prompt to test DeepSeekMath-Instruct and DeepSeekMath-RL:**
|
46 |
+
|
47 |
+
- English questions: **{question}\nPlease reason step by step, and put your final answer within \\boxed{}.**
|
48 |
+
|
49 |
+
- Chinese questions: **{question}\n请通过逐步推理来解答问题,并把最终答案放置于\\boxed{}中。**
|
50 |
+
|
51 |
+
```python
|
52 |
+
import torch
|
53 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM, GenerationConfig
|
54 |
+
|
55 |
+
model_name = "deepseek-ai/deepseek-math-7b-instruct"
|
56 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
57 |
+
model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype=torch.bfloat16, device_map="auto")
|
58 |
+
model.generation_config = GenerationConfig.from_pretrained(model_name)
|
59 |
+
model.generation_config.pad_token_id = model.generation_config.eos_token_id
|
60 |
+
|
61 |
+
messages = [
|
62 |
+
{"role": "user", "content": "what is the integral of x^2 from 0 to 2?\nPlease reason step by step, and put your final answer within \\boxed{}."}
|
63 |
+
]
|
64 |
+
input_tensor = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt")
|
65 |
+
outputs = model.generate(input_tensor.to(model.device), max_new_tokens=100)
|
66 |
+
|
67 |
+
result = tokenizer.decode(outputs[0][input_tensor.shape[1]:], skip_special_tokens=True)
|
68 |
+
print(result)
|
69 |
+
```
|
70 |
+
|
71 |
+
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.
|
72 |
+
|
73 |
+
```
|
74 |
+
User: {messages[0]['content']}
|
75 |
+
|
76 |
+
Assistant: {messages[1]['content']}<|end▁of▁sentence|>User: {messages[2]['content']}
|
77 |
+
|
78 |
+
Assistant:
|
79 |
+
```
|
80 |
+
|
81 |
+
**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.
|
82 |
+
|
83 |
+
### 3. License
|
84 |
+
This code repository is licensed under the MIT License. The use of DeepSeekMath models is subject to the Model License. DeepSeekMath supports commercial use.
|
85 |
+
|
86 |
+
See the [LICENSE-MODEL](https://github.com/deepseek-ai/DeepSeek-Math/blob/main/LICENSE-MODEL) for more details.
|
87 |
+
|
88 |
+
### 4. Contact
|
89 |
+
|
90 |
+
If you have any questions, please raise an issue or contact us at [service@deepseek.com](mailto:service@deepseek.com).
|
91 |
+
|
92 |
+
|
93 |
+
|