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