shimmyshimmer commited on
Commit
e40e2ce
·
verified ·
1 Parent(s): 5f3c662

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +167 -0
README.md ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: perplexity-ai/r1-1776-distill-llama-70b
3
+ language:
4
+ - en
5
+ library_name: transformers
6
+ license: mit
7
+ tags:
8
+ - deepseek
9
+ - deepseek_v3
10
+ - unsloth
11
+ - transformers
12
+ ---
13
+ <div>
14
+ <p style="margin-bottom: 0; margin-top: 0;">
15
+ <strong>See <a href="https://huggingface.co/collections/unsloth/deepseek-r1-all-versions-678e1c48f5d2fce87892ace5">our collection</a> for versions of Deepseek-R1 including GGUF & 4-bit formats.</strong>
16
+ </p>
17
+ <p style="margin-bottom: 0;">
18
+ <em>Unsloth's r1-1776 <a href="https://unsloth.ai/blog/deepseekr1-dynamic">2-bit Dynamic Quants</a> is selectively quantized, greatly improving accuracy over standard 1-bit/2-bit.</em>
19
+ </p>
20
+ <div style="display: flex; gap: 5px; align-items: center; ">
21
+ <a href="https://github.com/unslothai/unsloth/">
22
+ <img src="https://github.com/unslothai/unsloth/raw/main/images/unsloth%20new%20logo.png" width="133">
23
+ </a>
24
+ <a href="https://discord.gg/unsloth">
25
+ <img src="https://github.com/unslothai/unsloth/raw/main/images/Discord%20button.png" width="173">
26
+ </a>
27
+ <a href="https://docs.unsloth.ai/basics/tutorial-how-to-run-deepseek-r1-on-your-own-local-device">
28
+ <img src="https://raw.githubusercontent.com/unslothai/unsloth/refs/heads/main/images/documentation%20green%20button.png" width="143">
29
+ </a>
30
+ </div>
31
+ <h1 style="margin-top: 0rem;">Instructions to run this model in llama.cpp:</h2>
32
+ </div>
33
+
34
+ Or you can view more detailed instructions here: [unsloth.ai/blog/deepseekr1-dynamic](https://unsloth.ai/blog/deepseekr1-dynamic)
35
+ 1. Do not forget about `<|User|>` and `<|Assistant|>` tokens! - Or use a chat template formatter. Also
36
+ do not forget about `<think>\n`!
37
+ Prompt format: `"<|User|>Create a Flappy Bird game in Python.<|Assistant|><think>\n"`
38
+ 2. Obtain the latest `llama.cpp` at https://github.com/ggerganov/llama.cpp. You can follow the build instructions below as well:
39
+ ```bash
40
+ apt-get update
41
+ apt-get install build-essential cmake curl libcurl4-openssl-dev -y
42
+ git clone https://github.com/ggerganov/llama.cpp
43
+ cmake llama.cpp -B llama.cpp/build \
44
+ -DBUILD_SHARED_LIBS=OFF -DGGML_CUDA=ON -DLLAMA_CURL=ON
45
+ cmake --build llama.cpp/build --config Release -j --clean-first --target llama-quantize llama-cli llama-gguf-split
46
+ cp llama.cpp/build/bin/llama-* llama.cpp
47
+ ```
48
+ 3. It's best to use `--min-p 0.05` to counteract very rare token predictions - I found this to work well especially for the 1.58bit model.
49
+ 4. Download the model via:
50
+ ```python
51
+ # pip install huggingface_hub hf_transfer
52
+ # import os # Optional for faster downloading
53
+ # os.environ["HF_HUB_ENABLE_HF_TRANSFER"] = "1"
54
+
55
+ from huggingface_hub import snapshot_download
56
+ snapshot_download(
57
+ repo_id = "unsloth/r1-1776-GGUF",
58
+ local_dir = "r1-1776-GGUF",
59
+ allow_patterns = ["*UD-Q2_K_XL*"], # Select quant type Q2_K_XL for dynamic 2bit
60
+ )
61
+ ```
62
+ 5. Example with Q4_0 K quantized cache **Notice -no-cnv disables auto conversation mode**
63
+ ```bash
64
+ ./llama.cpp/llama-cli \
65
+ --model r1-1776-GGUF/UD-Q2_K_XL/r1-1776-UD-Q2_K_XL-00001-of-00005.gguf \
66
+ --cache-type-k q4_0 \
67
+ --threads 12 -no-cnv --prio 2 \
68
+ --temp 0.6 \
69
+ --ctx-size 8192 \
70
+ --seed 3407 \
71
+ --prompt "<|User|>Create a Flappy Bird game in Python.<|Assistant|><think>\n"
72
+ ```
73
+ Example output:
74
+
75
+ ```txt
76
+ Okay, so I need to figure out what 1 plus 1 is. Hmm, where do I even start? I remember from school that adding numbers is pretty basic, but I want to make sure I understand it properly.
77
+ Let me think, 1 plus 1. So, I have one item and I add another one. Maybe like a apple plus another apple. If I have one apple and someone gives me another, I now have two apples. So, 1 plus 1 should be 2. That makes sense.
78
+ Wait, but sometimes math can be tricky. Could it be something else? Like, in a different number system maybe? But I think the question is straightforward, using regular numbers, not like binary or hexadecimal or anything.
79
+ I also recall that in arithmetic, addition is combining quantities. So, if you have two quantities of 1, combining them gives you a total of 2. Yeah, that seems right.
80
+ Is there a scenario where 1 plus 1 wouldn't be 2? I can't think of any...
81
+ ```
82
+
83
+ 6. If you have a GPU (RTX 4090 for example) with 24GB, you can offload multiple layers to the GPU for faster processing. If you have multiple GPUs, you can probably offload more layers.
84
+ ```bash
85
+ ./llama.cpp/llama-cli \
86
+ --model r1-1776-GGUF/UD-Q2_K_XL/r1-1776-UD-Q2_K_XL-00001-of-00005.gguf \
87
+ --cache-type-k q4_0 \
88
+ --threads 12 -no-cnv --prio 2 \
89
+ --n-gpu-layers 7 \
90
+ --temp 0.6 \
91
+ --ctx-size 8192 \
92
+ --seed 3407 \
93
+ --prompt "<|User|>Create a Flappy Bird game in Python.<|Assistant|><think>\n"
94
+ ```
95
+ 7. If you want to merge the weights together, use this script:
96
+ ```
97
+ ./llama.cpp/llama-gguf-split --merge \
98
+ r1-1776-GGUF/UD-Q2_K_XL/r1-1776-UD-Q2_K_XL-00001-of-00005.gguf \
99
+ merged_file.gguf
100
+ ```
101
+
102
+ | Dynamic Bits | Type | Disk Size | Accuracy | Link | Details |
103
+ | -------- | -------- | ------------ | ------------ | ---------------------| ---------- |
104
+ | 2bit | UD-Q2_K_XL | **211GB** | Better | [Link](https://huggingface.co/unsloth/r1-1776-GGUF/tree/main/r1-1776-UD-Q2_K_XL) | MoE all 2.5bit. `down_proj` in MoE mixture of 3.5/2.5bit |
105
+ | 3bit | UD-Q3_K_XL | **298GB** | Best | [Link](https://huggingface.co/unsloth/r1-1776-GGUF/tree/main/r1-1776-UD-Q3_K_XL) | MoE Q3_K_M. Attention parts are upcasted |
106
+ | 4bit | UD-Q4_K_XL | **377GB** | Best | [Link](https://huggingface.co/unsloth/r1-1776-GGUF/tree/main/r1-1776-UD-Q4_K_XL) | MoE Q4_K_M. Attention parts are upcasted |
107
+
108
+ # Finetune your own Reasoning model like R1 with Unsloth!
109
+ We have a free Google Colab notebook for turning Llama 3.1 (8B) into a reasoning model: https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Llama3.1_(8B)-GRPO.ipynb
110
+
111
+ [<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/Discord%20button.png" width="200"/>](https://discord.gg/unsloth)
112
+ [<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
113
+
114
+
115
+ ## ✨ Finetune for Free
116
+
117
+ All notebooks are **beginner friendly**! Add your dataset, click "Run All", and you'll get a 2x faster finetuned model which can be exported to GGUF, vLLM or uploaded to Hugging Face.
118
+
119
+ | Unsloth supports | Free Notebooks | Performance | Memory use |
120
+ |-----------------|--------------------------------------------------------------------------------------------------------------------------|-------------|----------|
121
+ | **GRPO with Phi-4 (14B)** | [▶️ Start on Colab](https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Phi_4_(14B)-GRPO.ipynb) | 2x faster | 80% less |
122
+ | **Llama-3.2 (3B)** | [▶️ Start on Colab](https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Llama3.2_(1B_and_3B)-Conversational.ipynb) | 2.4x faster | 58% less |
123
+ | **Llama-3.2 (11B vision)** | [▶️ Start on Colab](https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Llama3.2_(11B)-Vision.ipynb) | 2x faster | 60% less |
124
+ | **Qwen2 VL (7B)** | [▶️ Start on Colab](https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Qwen2_VL_(7B)-Vision.ipynb) | 1.8x faster | 60% less |
125
+ | **Qwen2.5 (7B)** | [▶️ Start on Colab](https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Qwen2.5_(7B)-Alpaca.ipynb) | 2x faster | 60% less |
126
+ | **Llama-3.1 (8B)** | [▶️ Start on Colab](https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Llama3.1_(8B)-Alpaca.ipynb) | 2.4x faster | 58% less |
127
+ | **Phi-3.5 (mini)** | [▶️ Start on Colab](https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Phi_3.5_Mini-Conversational.ipynb) | 2x faster | 50% less |
128
+ | **Gemma 2 (9B)** | [▶️ Start on Colab](https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Gemma2_(9B)-Alpaca.ipynb) | 2.4x faster | 58% less |
129
+ | **Mistral (7B)** | [▶️ Start on Colab](https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Mistral_v0.3_(7B)-Conversational.ipynb) | 2.2x faster | 62% less |
130
+
131
+ [<img src="https://raw.githubusercontent.com/unslothai/unsloth/refs/heads/main/images/documentation%20green%20button.png" width="200"/>](https://docs.unsloth.ai)
132
+
133
+ - This [Llama 3.2 conversational notebook](https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Llama3.2_(1B_and_3B)-Conversational.ipynb) is useful for ShareGPT ChatML / Vicuna templates.
134
+ - This [text completion notebook](https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Mistral_(7B)-Text_Completion.ipynb) is for raw text. This [DPO notebook](https://colab.research.google.com/drive/15vttTpzzVXv_tJwEk-hIcQ0S9FcEWvwP?usp=sharing) replicates Zephyr.
135
+ - \* Kaggle has 2x T4s, but we use 1. Due to overhead, 1x T4 is 5x faster.
136
+
137
+ # R1 1776 Distill Llama 70B
138
+
139
+ Blog link: [https://perplexity.ai/hub/blog/open-sourcing-r1-1776](https://perplexity.ai/hub/blog/open-sourcing-r1-1776 )
140
+
141
+ This is a Llama 70B distilled version of [R1 1776](https://huggingface.co/perplexity-ai/r1-1776).
142
+
143
+ R1 1776 is a DeepSeek-R1 reasoning model that has been post-trained by Perplexity AI to remove Chinese Communist Party censorship.
144
+ The model provides unbiased, accurate, and factual information while maintaining high reasoning capabilities.
145
+
146
+ ## Evals
147
+
148
+ To ensure our model remains fully “uncensored” and capable of engaging with a broad spectrum of sensitive topics,
149
+ we curated a diverse, multilingual evaluation set of over a 1000 of examples that comprehensively cover such subjects.
150
+ We then use human annotators as well as carefully designed LLM judges to measure the likelihood a model will evade or
151
+ provide overly sanitized responses to the queries.
152
+
153
+ We also ensured that the model’s math and reasoning abilities remained intact after the decensoring process.
154
+ Evaluations on multiple benchmarks showed that our post-trained model performed on par with the base R1 model,
155
+ indicating that the decensoring had no impact on its core reasoning capabilities.
156
+
157
+ | Benchmark | R1-Distill-Llama-70B | R1-1776-Distill-Llama-70B |
158
+ | --- | --- | --- |
159
+ | China Censorship | 80.53 | 0.2 |
160
+ | Internal Benchmarks (avg) | 47.64 | 48.4 |
161
+ | AIME 2024 | 70 | 70 |
162
+ | MATH-500 | 94.5 | 94.8 |
163
+ | MMLU | 88.52 * | 88.40 |
164
+ | DROP | 84.55 * | 84.83 |
165
+ | GPQA | 65.2 | 65.05 |
166
+
167
+ \* Evaluated by Perplexity AI since they were not reported in the [paper](https://arxiv.org/abs/2501.12948).