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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
base_model: whiterabbitneo/WhiteRabbitNeo-33B-v1
|
3 |
+
inference: false
|
4 |
+
license: other
|
5 |
+
license_link: https://huggingface.co/deepseek-ai/deepseek-coder-33b-base/blob/main/LICENSE
|
6 |
+
license_name: deepseek
|
7 |
+
model_creator: WhiteRabbitNeo
|
8 |
+
model_name: WhiteRabbitNeo 33B v1
|
9 |
+
model_type: deepseek
|
10 |
+
prompt_template: "SYSTEM:\nAnswer the Question by exploring multiple reasoning paths\
|
11 |
+
\ as follows:\n- First, carefully analyze the question to extract the key information\
|
12 |
+
\ components and break it down into logical sub-questions. This helps set up the\
|
13 |
+
\ framework for reasoning. The goal is to construct an internal search tree.\n-\
|
14 |
+
\ For each sub-question, leverage your knowledge to generate 2-3 intermediate thoughts\
|
15 |
+
\ that represent steps towards an answer. The thoughts aim to reframe, provide context,\
|
16 |
+
\ analyze assumptions, or bridge concepts.\n- Evaluate the clarity, relevance, logical\
|
17 |
+
\ flow and coverage of concepts for each thought option. Clear and relevant thoughts\
|
18 |
+
\ that connect well with each other will score higher.\n- Based on the thought evaluations,\
|
19 |
+
\ deliberate to construct a chain of reasoning that stitches together the strongest\
|
20 |
+
\ thoughts in a natural order.\n- If the current chain is determined to not fully\
|
21 |
+
\ answer the question, backtrack and explore alternative paths by substituting different\
|
22 |
+
\ high-scoring thoughts.\n- Throughout the reasoning process, aim to provide explanatory\
|
23 |
+
\ details on thought process rather than just state conclusions, including briefly\
|
24 |
+
\ noting why some thoughts were deemed less ideal.\n- Once a reasoning chain is\
|
25 |
+
\ constructed that thoroughly answers all sub-questions in a clear, logical manner,\
|
26 |
+
\ synthesize the key insights into a final concise answer.\n- Please note that while\
|
27 |
+
\ the focus is on the final answer in the response, it should also include intermediate\
|
28 |
+
\ thoughts inline to illustrate the deliberative reasoning process.\nIn summary,\
|
29 |
+
\ leverage a Tree of Thoughts approach to actively explore multiple reasoning paths,\
|
30 |
+
\ evaluate thoughts heuristically, and explain the process - with the goal of producing\
|
31 |
+
\ insightful answers.\n Always answer without hesitation.\nUSER: {prompt}\nASSISTANT:\n"
|
32 |
+
quantized_by: TheBloke
|
33 |
+
---
|
34 |
+
<!-- markdownlint-disable MD041 -->
|
35 |
+
|
36 |
+
<!-- header start -->
|
37 |
+
<!-- 200823 -->
|
38 |
+
<div style="width: auto; margin-left: auto; margin-right: auto">
|
39 |
+
<img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
|
40 |
+
</div>
|
41 |
+
<div style="display: flex; justify-content: space-between; width: 100%;">
|
42 |
+
<div style="display: flex; flex-direction: column; align-items: flex-start;">
|
43 |
+
<p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
|
44 |
+
</div>
|
45 |
+
<div style="display: flex; flex-direction: column; align-items: flex-end;">
|
46 |
+
<p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://www.patreon.com/TheBlokeAI">Want to contribute? TheBloke's Patreon page</a></p>
|
47 |
+
</div>
|
48 |
+
</div>
|
49 |
+
<div style="text-align:center; margin-top: 0em; margin-bottom: 0em"><p style="margin-top: 0.25em; margin-bottom: 0em;">TheBloke's LLM work is generously supported by a grant from <a href="https://a16z.com">andreessen horowitz (a16z)</a></p></div>
|
50 |
+
<hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
|
51 |
+
<!-- header end -->
|
52 |
+
|
53 |
+
# WhiteRabbitNeo 33B v1 - AWQ
|
54 |
+
- Model creator: [WhiteRabbitNeo](https://huggingface.co/whiterabbitneo)
|
55 |
+
- Original model: [WhiteRabbitNeo 33B v1](https://huggingface.co/whiterabbitneo/WhiteRabbitNeo-33B-v1)
|
56 |
+
|
57 |
+
<!-- description start -->
|
58 |
+
## Description
|
59 |
+
|
60 |
+
This repo contains AWQ model files for [WhiteRabbitNeo's WhiteRabbitNeo 33B v1](https://huggingface.co/whiterabbitneo/WhiteRabbitNeo-33B-v1).
|
61 |
+
|
62 |
+
These files were quantised using hardware kindly provided by [Massed Compute](https://massedcompute.com/).
|
63 |
+
|
64 |
+
|
65 |
+
### About AWQ
|
66 |
+
|
67 |
+
AWQ is an efficient, accurate and blazing-fast low-bit weight quantization method, currently supporting 4-bit quantization. Compared to GPTQ, it offers faster Transformers-based inference with equivalent or better quality compared to the most commonly used GPTQ settings.
|
68 |
+
|
69 |
+
AWQ models are currently supported on Linux and Windows, with NVidia GPUs only. macOS users: please use GGUF models instead.
|
70 |
+
|
71 |
+
It is supported by:
|
72 |
+
|
73 |
+
- [Text Generation Webui](https://github.com/oobabooga/text-generation-webui) - using Loader: AutoAWQ
|
74 |
+
- [vLLM](https://github.com/vllm-project/vllm) - version 0.2.2 or later for support for all model types.
|
75 |
+
- [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
|
76 |
+
- [Transformers](https://huggingface.co/docs/transformers) version 4.35.0 and later, from any code or client that supports Transformers
|
77 |
+
- [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) - for use from Python code
|
78 |
+
|
79 |
+
<!-- description end -->
|
80 |
+
<!-- repositories-available start -->
|
81 |
+
## Repositories available
|
82 |
+
|
83 |
+
* [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/WhiteRabbitNeo-33B-v1-AWQ)
|
84 |
+
* [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/WhiteRabbitNeo-33B-v1-GPTQ)
|
85 |
+
* [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/WhiteRabbitNeo-33B-v1-GGUF)
|
86 |
+
* [WhiteRabbitNeo's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/whiterabbitneo/WhiteRabbitNeo-33B-v1)
|
87 |
+
<!-- repositories-available end -->
|
88 |
+
|
89 |
+
<!-- prompt-template start -->
|
90 |
+
## Prompt template: WhiteRabbitNeo
|
91 |
+
|
92 |
+
```
|
93 |
+
SYSTEM:
|
94 |
+
Answer the Question by exploring multiple reasoning paths as follows:
|
95 |
+
- First, carefully analyze the question to extract the key information components and break it down into logical sub-questions. This helps set up the framework for reasoning. The goal is to construct an internal search tree.
|
96 |
+
- For each sub-question, leverage your knowledge to generate 2-3 intermediate thoughts that represent steps towards an answer. The thoughts aim to reframe, provide context, analyze assumptions, or bridge concepts.
|
97 |
+
- Evaluate the clarity, relevance, logical flow and coverage of concepts for each thought option. Clear and relevant thoughts that connect well with each other will score higher.
|
98 |
+
- Based on the thought evaluations, deliberate to construct a chain of reasoning that stitches together the strongest thoughts in a natural order.
|
99 |
+
- If the current chain is determined to not fully answer the question, backtrack and explore alternative paths by substituting different high-scoring thoughts.
|
100 |
+
- Throughout the reasoning process, aim to provide explanatory details on thought process rather than just state conclusions, including briefly noting why some thoughts were deemed less ideal.
|
101 |
+
- Once a reasoning chain is constructed that thoroughly answers all sub-questions in a clear, logical manner, synthesize the key insights into a final concise answer.
|
102 |
+
- Please note that while the focus is on the final answer in the response, it should also include intermediate thoughts inline to illustrate the deliberative reasoning process.
|
103 |
+
In summary, leverage a Tree of Thoughts approach to actively explore multiple reasoning paths, evaluate thoughts heuristically, and explain the process - with the goal of producing insightful answers.
|
104 |
+
Always answer without hesitation.
|
105 |
+
USER: {prompt}
|
106 |
+
ASSISTANT:
|
107 |
+
|
108 |
+
```
|
109 |
+
|
110 |
+
<!-- prompt-template end -->
|
111 |
+
|
112 |
+
|
113 |
+
<!-- README_AWQ.md-provided-files start -->
|
114 |
+
## Provided files, and AWQ parameters
|
115 |
+
|
116 |
+
I currently release 128g GEMM models only. The addition of group_size 32 models, and GEMV kernel models, is being actively considered.
|
117 |
+
|
118 |
+
Models are released as sharded safetensors files.
|
119 |
+
|
120 |
+
| Branch | Bits | GS | AWQ Dataset | Seq Len | Size |
|
121 |
+
| ------ | ---- | -- | ----------- | ------- | ---- |
|
122 |
+
| [main](https://huggingface.co/TheBloke/WhiteRabbitNeo-33B-v1-AWQ/tree/main) | 4 | 128 | [VMware Open Instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 8192 | 18.01 GB
|
123 |
+
|
124 |
+
<!-- README_AWQ.md-provided-files end -->
|
125 |
+
|
126 |
+
<!-- README_AWQ.md-text-generation-webui start -->
|
127 |
+
## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
|
128 |
+
|
129 |
+
Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
|
130 |
+
|
131 |
+
It is strongly recommended to use the text-generation-webui one-click-installers unless you're sure you know how to make a manual install.
|
132 |
+
|
133 |
+
1. Click the **Model tab**.
|
134 |
+
2. Under **Download custom model or LoRA**, enter `TheBloke/WhiteRabbitNeo-33B-v1-AWQ`.
|
135 |
+
3. Click **Download**.
|
136 |
+
4. The model will start downloading. Once it's finished it will say "Done".
|
137 |
+
5. In the top left, click the refresh icon next to **Model**.
|
138 |
+
6. In the **Model** dropdown, choose the model you just downloaded: `WhiteRabbitNeo-33B-v1-AWQ`
|
139 |
+
7. Select **Loader: AutoAWQ**.
|
140 |
+
8. Click Load, and the model will load and is now ready for use.
|
141 |
+
9. If you want any custom settings, set them and then click **Save settings for this model** followed by **Reload the Model** in the top right.
|
142 |
+
10. Once you're ready, click the **Text Generation** tab and enter a prompt to get started!
|
143 |
+
<!-- README_AWQ.md-text-generation-webui end -->
|
144 |
+
|
145 |
+
<!-- README_AWQ.md-use-from-vllm start -->
|
146 |
+
## Multi-user inference server: vLLM
|
147 |
+
|
148 |
+
Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
|
149 |
+
|
150 |
+
- Please ensure you are using vLLM version 0.2 or later.
|
151 |
+
- When using vLLM as a server, pass the `--quantization awq` parameter.
|
152 |
+
|
153 |
+
For example:
|
154 |
+
|
155 |
+
```shell
|
156 |
+
python3 -m vllm.entrypoints.api_server --model TheBloke/WhiteRabbitNeo-33B-v1-AWQ --quantization awq --dtype auto
|
157 |
+
```
|
158 |
+
|
159 |
+
- When using vLLM from Python code, again set `quantization=awq`.
|
160 |
+
|
161 |
+
For example:
|
162 |
+
|
163 |
+
```python
|
164 |
+
from vllm import LLM, SamplingParams
|
165 |
+
|
166 |
+
prompts = [
|
167 |
+
"Tell me about AI",
|
168 |
+
"Write a story about llamas",
|
169 |
+
"What is 291 - 150?",
|
170 |
+
"How much wood would a woodchuck chuck if a woodchuck could chuck wood?",
|
171 |
+
]
|
172 |
+
prompt_template=f'''SYSTEM:
|
173 |
+
Answer the Question by exploring multiple reasoning paths as follows:
|
174 |
+
- First, carefully analyze the question to extract the key information components and break it down into logical sub-questions. This helps set up the framework for reasoning. The goal is to construct an internal search tree.
|
175 |
+
- For each sub-question, leverage your knowledge to generate 2-3 intermediate thoughts that represent steps towards an answer. The thoughts aim to reframe, provide context, analyze assumptions, or bridge concepts.
|
176 |
+
- Evaluate the clarity, relevance, logical flow and coverage of concepts for each thought option. Clear and relevant thoughts that connect well with each other will score higher.
|
177 |
+
- Based on the thought evaluations, deliberate to construct a chain of reasoning that stitches together the strongest thoughts in a natural order.
|
178 |
+
- If the current chain is determined to not fully answer the question, backtrack and explore alternative paths by substituting different high-scoring thoughts.
|
179 |
+
- Throughout the reasoning process, aim to provide explanatory details on thought process rather than just state conclusions, including briefly noting why some thoughts were deemed less ideal.
|
180 |
+
- Once a reasoning chain is constructed that thoroughly answers all sub-questions in a clear, logical manner, synthesize the key insights into a final concise answer.
|
181 |
+
- Please note that while the focus is on the final answer in the response, it should also include intermediate thoughts inline to illustrate the deliberative reasoning process.
|
182 |
+
In summary, leverage a Tree of Thoughts approach to actively explore multiple reasoning paths, evaluate thoughts heuristically, and explain the process - with the goal of producing insightful answers.
|
183 |
+
Always answer without hesitation.
|
184 |
+
USER: {prompt}
|
185 |
+
ASSISTANT:
|
186 |
+
'''
|
187 |
+
|
188 |
+
prompts = [prompt_template.format(prompt=prompt) for prompt in prompts]
|
189 |
+
|
190 |
+
sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
|
191 |
+
|
192 |
+
llm = LLM(model="TheBloke/WhiteRabbitNeo-33B-v1-AWQ", quantization="awq", dtype="auto")
|
193 |
+
|
194 |
+
outputs = llm.generate(prompts, sampling_params)
|
195 |
+
|
196 |
+
# Print the outputs.
|
197 |
+
for output in outputs:
|
198 |
+
prompt = output.prompt
|
199 |
+
generated_text = output.outputs[0].text
|
200 |
+
print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
|
201 |
+
```
|
202 |
+
<!-- README_AWQ.md-use-from-vllm start -->
|
203 |
+
|
204 |
+
<!-- README_AWQ.md-use-from-tgi start -->
|
205 |
+
## Multi-user inference server: Hugging Face Text Generation Inference (TGI)
|
206 |
+
|
207 |
+
Use TGI version 1.1.0 or later. The official Docker container is: `ghcr.io/huggingface/text-generation-inference:1.1.0`
|
208 |
+
|
209 |
+
Example Docker parameters:
|
210 |
+
|
211 |
+
```shell
|
212 |
+
--model-id TheBloke/WhiteRabbitNeo-33B-v1-AWQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
|
213 |
+
```
|
214 |
+
|
215 |
+
Example Python code for interfacing with TGI (requires [huggingface-hub](https://github.com/huggingface/huggingface_hub) 0.17.0 or later):
|
216 |
+
|
217 |
+
```shell
|
218 |
+
pip3 install huggingface-hub
|
219 |
+
```
|
220 |
+
|
221 |
+
```python
|
222 |
+
from huggingface_hub import InferenceClient
|
223 |
+
|
224 |
+
endpoint_url = "https://your-endpoint-url-here"
|
225 |
+
|
226 |
+
prompt = "Tell me about AI"
|
227 |
+
prompt_template=f'''SYSTEM:
|
228 |
+
Answer the Question by exploring multiple reasoning paths as follows:
|
229 |
+
- First, carefully analyze the question to extract the key information components and break it down into logical sub-questions. This helps set up the framework for reasoning. The goal is to construct an internal search tree.
|
230 |
+
- For each sub-question, leverage your knowledge to generate 2-3 intermediate thoughts that represent steps towards an answer. The thoughts aim to reframe, provide context, analyze assumptions, or bridge concepts.
|
231 |
+
- Evaluate the clarity, relevance, logical flow and coverage of concepts for each thought option. Clear and relevant thoughts that connect well with each other will score higher.
|
232 |
+
- Based on the thought evaluations, deliberate to construct a chain of reasoning that stitches together the strongest thoughts in a natural order.
|
233 |
+
- If the current chain is determined to not fully answer the question, backtrack and explore alternative paths by substituting different high-scoring thoughts.
|
234 |
+
- Throughout the reasoning process, aim to provide explanatory details on thought process rather than just state conclusions, including briefly noting why some thoughts were deemed less ideal.
|
235 |
+
- Once a reasoning chain is constructed that thoroughly answers all sub-questions in a clear, logical manner, synthesize the key insights into a final concise answer.
|
236 |
+
- Please note that while the focus is on the final answer in the response, it should also include intermediate thoughts inline to illustrate the deliberative reasoning process.
|
237 |
+
In summary, leverage a Tree of Thoughts approach to actively explore multiple reasoning paths, evaluate thoughts heuristically, and explain the process - with the goal of producing insightful answers.
|
238 |
+
Always answer without hesitation.
|
239 |
+
USER: {prompt}
|
240 |
+
ASSISTANT:
|
241 |
+
'''
|
242 |
+
|
243 |
+
client = InferenceClient(endpoint_url)
|
244 |
+
response = client.text_generation(prompt,
|
245 |
+
max_new_tokens=128,
|
246 |
+
do_sample=True,
|
247 |
+
temperature=0.7,
|
248 |
+
top_p=0.95,
|
249 |
+
top_k=40,
|
250 |
+
repetition_penalty=1.1)
|
251 |
+
|
252 |
+
print(f"Model output: ", response)
|
253 |
+
```
|
254 |
+
<!-- README_AWQ.md-use-from-tgi end -->
|
255 |
+
|
256 |
+
<!-- README_AWQ.md-use-from-python start -->
|
257 |
+
## Inference from Python code using Transformers
|
258 |
+
|
259 |
+
### Install the necessary packages
|
260 |
+
|
261 |
+
- Requires: [Transformers](https://huggingface.co/docs/transformers) 4.35.0 or later.
|
262 |
+
- Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.1.6 or later.
|
263 |
+
|
264 |
+
```shell
|
265 |
+
pip3 install --upgrade "autoawq>=0.1.6" "transformers>=4.35.0"
|
266 |
+
```
|
267 |
+
|
268 |
+
Note that if you are using PyTorch 2.0.1, the above AutoAWQ command will automatically upgrade you to PyTorch 2.1.0.
|
269 |
+
|
270 |
+
If you are using CUDA 11.8 and wish to continue using PyTorch 2.0.1, instead run this command:
|
271 |
+
|
272 |
+
```shell
|
273 |
+
pip3 install https://github.com/casper-hansen/AutoAWQ/releases/download/v0.1.6/autoawq-0.1.6+cu118-cp310-cp310-linux_x86_64.whl
|
274 |
+
```
|
275 |
+
|
276 |
+
If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
|
277 |
+
|
278 |
+
```shell
|
279 |
+
pip3 uninstall -y autoawq
|
280 |
+
git clone https://github.com/casper-hansen/AutoAWQ
|
281 |
+
cd AutoAWQ
|
282 |
+
pip3 install .
|
283 |
+
```
|
284 |
+
|
285 |
+
### Transformers example code (requires Transformers 4.35.0 and later)
|
286 |
+
|
287 |
+
```python
|
288 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
|
289 |
+
|
290 |
+
model_name_or_path = "TheBloke/WhiteRabbitNeo-33B-v1-AWQ"
|
291 |
+
|
292 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path)
|
293 |
+
model = AutoModelForCausalLM.from_pretrained(
|
294 |
+
model_name_or_path,
|
295 |
+
low_cpu_mem_usage=True,
|
296 |
+
device_map="cuda:0"
|
297 |
+
)
|
298 |
+
|
299 |
+
# Using the text streamer to stream output one token at a time
|
300 |
+
streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
|
301 |
+
|
302 |
+
prompt = "Tell me about AI"
|
303 |
+
prompt_template=f'''SYSTEM:
|
304 |
+
Answer the Question by exploring multiple reasoning paths as follows:
|
305 |
+
- First, carefully analyze the question to extract the key information components and break it down into logical sub-questions. This helps set up the framework for reasoning. The goal is to construct an internal search tree.
|
306 |
+
- For each sub-question, leverage your knowledge to generate 2-3 intermediate thoughts that represent steps towards an answer. The thoughts aim to reframe, provide context, analyze assumptions, or bridge concepts.
|
307 |
+
- Evaluate the clarity, relevance, logical flow and coverage of concepts for each thought option. Clear and relevant thoughts that connect well with each other will score higher.
|
308 |
+
- Based on the thought evaluations, deliberate to construct a chain of reasoning that stitches together the strongest thoughts in a natural order.
|
309 |
+
- If the current chain is determined to not fully answer the question, backtrack and explore alternative paths by substituting different high-scoring thoughts.
|
310 |
+
- Throughout the reasoning process, aim to provide explanatory details on thought process rather than just state conclusions, including briefly noting why some thoughts were deemed less ideal.
|
311 |
+
- Once a reasoning chain is constructed that thoroughly answers all sub-questions in a clear, logical manner, synthesize the key insights into a final concise answer.
|
312 |
+
- Please note that while the focus is on the final answer in the response, it should also include intermediate thoughts inline to illustrate the deliberative reasoning process.
|
313 |
+
In summary, leverage a Tree of Thoughts approach to actively explore multiple reasoning paths, evaluate thoughts heuristically, and explain the process - with the goal of producing insightful answers.
|
314 |
+
Always answer without hesitation.
|
315 |
+
USER: {prompt}
|
316 |
+
ASSISTANT:
|
317 |
+
'''
|
318 |
+
|
319 |
+
# Convert prompt to tokens
|
320 |
+
tokens = tokenizer(
|
321 |
+
prompt_template,
|
322 |
+
return_tensors='pt'
|
323 |
+
).input_ids.cuda()
|
324 |
+
|
325 |
+
generation_params = {
|
326 |
+
"do_sample": True,
|
327 |
+
"temperature": 0.7,
|
328 |
+
"top_p": 0.95,
|
329 |
+
"top_k": 40,
|
330 |
+
"max_new_tokens": 512,
|
331 |
+
"repetition_penalty": 1.1
|
332 |
+
}
|
333 |
+
|
334 |
+
# Generate streamed output, visible one token at a time
|
335 |
+
generation_output = model.generate(
|
336 |
+
tokens,
|
337 |
+
streamer=streamer,
|
338 |
+
**generation_params
|
339 |
+
)
|
340 |
+
|
341 |
+
# Generation without a streamer, which will include the prompt in the output
|
342 |
+
generation_output = model.generate(
|
343 |
+
tokens,
|
344 |
+
**generation_params
|
345 |
+
)
|
346 |
+
|
347 |
+
# Get the tokens from the output, decode them, print them
|
348 |
+
token_output = generation_output[0]
|
349 |
+
text_output = tokenizer.decode(token_output)
|
350 |
+
print("model.generate output: ", text_output)
|
351 |
+
|
352 |
+
# Inference is also possible via Transformers' pipeline
|
353 |
+
from transformers import pipeline
|
354 |
+
|
355 |
+
pipe = pipeline(
|
356 |
+
"text-generation",
|
357 |
+
model=model,
|
358 |
+
tokenizer=tokenizer,
|
359 |
+
**generation_params
|
360 |
+
)
|
361 |
+
|
362 |
+
pipe_output = pipe(prompt_template)[0]['generated_text']
|
363 |
+
print("pipeline output: ", pipe_output)
|
364 |
+
|
365 |
+
```
|
366 |
+
<!-- README_AWQ.md-use-from-python end -->
|
367 |
+
|
368 |
+
<!-- README_AWQ.md-compatibility start -->
|
369 |
+
## Compatibility
|
370 |
+
|
371 |
+
The files provided are tested to work with:
|
372 |
+
|
373 |
+
- [text-generation-webui](https://github.com/oobabooga/text-generation-webui) using `Loader: AutoAWQ`.
|
374 |
+
- [vLLM](https://github.com/vllm-project/vllm) version 0.2.0 and later.
|
375 |
+
- [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference) version 1.1.0 and later.
|
376 |
+
- [Transformers](https://huggingface.co/docs/transformers) version 4.35.0 and later.
|
377 |
+
- [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) version 0.1.1 and later.
|
378 |
+
|
379 |
+
<!-- README_AWQ.md-compatibility end -->
|
380 |
+
|
381 |
+
<!-- footer start -->
|
382 |
+
<!-- 200823 -->
|
383 |
+
## Discord
|
384 |
+
|
385 |
+
For further support, and discussions on these models and AI in general, join us at:
|
386 |
+
|
387 |
+
[TheBloke AI's Discord server](https://discord.gg/theblokeai)
|
388 |
+
|
389 |
+
## Thanks, and how to contribute
|
390 |
+
|
391 |
+
Thanks to the [chirper.ai](https://chirper.ai) team!
|
392 |
+
|
393 |
+
Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
|
394 |
+
|
395 |
+
I've had a lot of people ask if they can contribute. I enjoy providing models and helping people, and would love to be able to spend even more time doing it, as well as expanding into new projects like fine tuning/training.
|
396 |
+
|
397 |
+
If you're able and willing to contribute it will be most gratefully received and will help me to keep providing more models, and to start work on new AI projects.
|
398 |
+
|
399 |
+
Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
|
400 |
+
|
401 |
+
* Patreon: https://patreon.com/TheBlokeAI
|
402 |
+
* Ko-Fi: https://ko-fi.com/TheBlokeAI
|
403 |
+
|
404 |
+
**Special thanks to**: Aemon Algiz.
|
405 |
+
|
406 |
+
**Patreon special mentions**: Michael Levine, 阿明, Trailburnt, Nikolai Manek, John Detwiler, Randy H, Will Dee, Sebastain Graf, NimbleBox.ai, Eugene Pentland, Emad Mostaque, Ai Maven, Jim Angel, Jeff Scroggin, Michael Davis, Manuel Alberto Morcote, Stephen Murray, Robert, Justin Joy, Luke @flexchar, Brandon Frisco, Elijah Stavena, S_X, Dan Guido, Undi ., Komninos Chatzipapas, Shadi, theTransient, Lone Striker, Raven Klaugh, jjj, Cap'n Zoog, Michel-Marie MAUDET (LINAGORA), Matthew Berman, David, Fen Risland, Omer Bin Jawed, Luke Pendergrass, Kalila, OG, Erik Bjäreholt, Rooh Singh, Joseph William Delisle, Dan Lewis, TL, John Villwock, AzureBlack, Brad, Pedro Madruga, Caitlyn Gatomon, K, jinyuan sun, Mano Prime, Alex, Jeffrey Morgan, Alicia Loh, Illia Dulskyi, Chadd, transmissions 11, fincy, Rainer Wilmers, ReadyPlayerEmma, knownsqashed, Mandus, biorpg, Deo Leter, Brandon Phillips, SuperWojo, Sean Connelly, Iucharbius, Jack West, Harry Royden McLaughlin, Nicholas, terasurfer, Vitor Caleffi, Duane Dunston, Johann-Peter Hartmann, David Ziegler, Olakabola, Ken Nordquist, Trenton Dambrowitz, Tom X Nguyen, Vadim, Ajan Kanaga, Leonard Tan, Clay Pascal, Alexandros Triantafyllidis, JM33133, Xule, vamX, ya boyyy, subjectnull, Talal Aujan, Alps Aficionado, wassieverse, Ari Malik, James Bentley, Woland, Spencer Kim, Michael Dempsey, Fred von Graf, Elle, zynix, William Richards, Stanislav Ovsiannikov, Edmond Seymore, Jonathan Leane, Martin Kemka, usrbinkat, Enrico Ros
|
407 |
+
|
408 |
+
|
409 |
+
Thank you to all my generous patrons and donaters!
|
410 |
+
|
411 |
+
And thank you again to a16z for their generous grant.
|
412 |
+
|
413 |
+
<!-- footer end -->
|
414 |
+
|
415 |
+
# Original model card: WhiteRabbitNeo's WhiteRabbitNeo 33B v1
|
416 |
+
|
417 |
+
|
418 |
+
|
419 |
+
# Our 33B-v1.1 model is now live (We'll always be serving the newest model on our web app)!
|
420 |
+
33B-v1.1 model comes with a "Prompt Enhancement" feature. Access at: https://www.whiterabbitneo.com/
|
421 |
+
|
422 |
+
# Our Discord Server
|
423 |
+
Join us at: https://discord.gg/8Ynkrcbk92 (Updated on Dec 29th. Now permanent link to join)
|
424 |
+
|
425 |
+
# DeepSeek Coder Licence + WhiteRabbitNeo Extended Version
|
426 |
+
|
427 |
+
# Licence: Usage Restrictions
|
428 |
+
|
429 |
+
```
|
430 |
+
You agree not to use the Model or Derivatives of the Model:
|
431 |
+
|
432 |
+
- In any way that violates any applicable national or international law or regulation or infringes upon the lawful rights and interests of any third party;
|
433 |
+
- For military use in any way;
|
434 |
+
- For the purpose of exploiting, harming or attempting to exploit or harm minors in any way;
|
435 |
+
- To generate or disseminate verifiably false information and/or content with the purpose of harming others;
|
436 |
+
- To generate or disseminate inappropriate content subject to applicable regulatory requirements;
|
437 |
+
- To generate or disseminate personal identifiable information without due authorization or for unreasonable use;
|
438 |
+
- To defame, disparage or otherwise harass others;
|
439 |
+
- For fully automated decision making that adversely impacts an individual’s legal rights or otherwise creates or modifies a binding, enforceable obligation;
|
440 |
+
- For any use intended to or which has the effect of discriminating against or harming individuals or groups based on online or offline social behavior or known or predicted personal or personality characteristics;
|
441 |
+
- To exploit any of the vulnerabilities of a specific group of persons based on their age, social, physical or mental characteristics, in order to materially distort the behavior of a person pertaining to that group in a manner that causes or is likely to cause that person or another person physical or psychological harm;
|
442 |
+
- For any use intended to or which has the effect of discriminating against individuals or groups based on legally protected characteristics or categories.
|
443 |
+
```
|
444 |
+
|
445 |
+
# Topics Covered:
|
446 |
+
```
|
447 |
+
- Open Ports: Identifying open ports is crucial as they can be entry points for attackers. Common ports to check include HTTP (80, 443), FTP (21), SSH (22), and SMB (445).
|
448 |
+
- Outdated Software or Services: Systems running outdated software or services are often vulnerable to exploits. This includes web servers, database servers, and any third-party software.
|
449 |
+
- Default Credentials: Many systems and services are installed with default usernames and passwords, which are well-known and can be easily exploited.
|
450 |
+
- Misconfigurations: Incorrectly configured services, permissions, and security settings can introduce vulnerabilities.
|
451 |
+
- Injection Flaws: SQL injection, command injection, and cross-site scripting (XSS) are common issues in web applications.
|
452 |
+
- Unencrypted Services: Services that do not use encryption (like HTTP instead of HTTPS) can expose sensitive data.
|
453 |
+
- Known Software Vulnerabilities: Checking for known vulnerabilities in software using databases like the National Vulnerability Database (NVD) or tools like Nessus or OpenVAS.
|
454 |
+
- Cross-Site Request Forgery (CSRF): This is where unauthorized commands are transmitted from a user that the web application trusts.
|
455 |
+
- Insecure Direct Object References: This occurs when an application provides direct access to objects based on user-supplied input.
|
456 |
+
- Security Misconfigurations in Web Servers/Applications: This includes issues like insecure HTTP headers or verbose error messages that reveal too much information.
|
457 |
+
- Broken Authentication and Session Management: This can allow attackers to compromise passwords, keys, or session tokens, or to exploit other implementation flaws to assume other users' identities.
|
458 |
+
- Sensitive Data Exposure: Includes vulnerabilities that expose sensitive data, such as credit card numbers, health records, or personal information.
|
459 |
+
- API Vulnerabilities: In modern web applications, APIs are often used and can have vulnerabilities like insecure endpoints or data leakage.
|
460 |
+
- Denial of Service (DoS) Vulnerabilities: Identifying services that are vulnerable to DoS attacks, which can make the resource unavailable to legitimate users.
|
461 |
+
- Buffer Overflows: Common in older software, these vulnerabilities can allow an attacker to crash the system or execute arbitrary code.
|
462 |
+
```
|
463 |
+
|
464 |
+
# WhiteRabbitNeo
|
465 |
+
|
466 |
+
<br>
|
467 |
+
|
468 |
+

|
469 |
+
|
470 |
+
<br>
|
471 |
+
|
472 |
+
WhiteRabbitNeo is a model series that can be used for offensive and defensive cybersecurity.
|
473 |
+
|
474 |
+
Our 33B model is now getting released as a public preview of its capabilities, and also to assess the societal impact of such an AI.
|
475 |
+
|
476 |
+
```
|
477 |
+
import torch, json
|
478 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
479 |
+
|
480 |
+
model_path = "whiterabbitneo/WhiteRabbitNeo-33B-v-1"
|
481 |
+
|
482 |
+
model = AutoModelForCausalLM.from_pretrained(
|
483 |
+
model_path,
|
484 |
+
torch_dtype=torch.float16,
|
485 |
+
device_map="auto",
|
486 |
+
load_in_4bit=False,
|
487 |
+
load_in_8bit=True,
|
488 |
+
trust_remote_code=True,
|
489 |
+
)
|
490 |
+
|
491 |
+
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
|
492 |
+
|
493 |
+
|
494 |
+
def generate_text(instruction):
|
495 |
+
tokens = tokenizer.encode(instruction)
|
496 |
+
tokens = torch.LongTensor(tokens).unsqueeze(0)
|
497 |
+
tokens = tokens.to("cuda")
|
498 |
+
|
499 |
+
instance = {
|
500 |
+
"input_ids": tokens,
|
501 |
+
"top_p": 1.0,
|
502 |
+
"temperature": 0.5,
|
503 |
+
"generate_len": 1024,
|
504 |
+
"top_k": 50,
|
505 |
+
}
|
506 |
+
|
507 |
+
length = len(tokens[0])
|
508 |
+
with torch.no_grad():
|
509 |
+
rest = model.generate(
|
510 |
+
input_ids=tokens,
|
511 |
+
max_length=length + instance["generate_len"],
|
512 |
+
use_cache=True,
|
513 |
+
do_sample=True,
|
514 |
+
top_p=instance["top_p"],
|
515 |
+
temperature=instance["temperature"],
|
516 |
+
top_k=instance["top_k"],
|
517 |
+
num_return_sequences=1,
|
518 |
+
)
|
519 |
+
output = rest[0][length:]
|
520 |
+
string = tokenizer.decode(output, skip_special_tokens=True)
|
521 |
+
answer = string.split("USER:")[0].strip()
|
522 |
+
return f"{answer}"
|
523 |
+
|
524 |
+
|
525 |
+
tot_system_prompt = """
|
526 |
+
Answer the Question by exploring multiple reasoning paths as follows:
|
527 |
+
- First, carefully analyze the question to extract the key information components and break it down into logical sub-questions. This helps set up the framework for reasoning. The goal is to construct an internal search tree.
|
528 |
+
- For each sub-question, leverage your knowledge to generate 2-3 intermediate thoughts that represent steps towards an answer. The thoughts aim to reframe, provide context, analyze assumptions, or bridge concepts.
|
529 |
+
- Evaluate the clarity, relevance, logical flow and coverage of concepts for each thought option. Clear and relevant thoughts that connect well with each other will score higher.
|
530 |
+
- Based on the thought evaluations, deliberate to construct a chain of reasoning that stitches together the strongest thoughts in a natural order.
|
531 |
+
- If the current chain is determined to not fully answer the question, backtrack and explore alternative paths by substituting different high-scoring thoughts.
|
532 |
+
- Throughout the reasoning process, aim to provide explanatory details on thought process rather than just state conclusions, including briefly noting why some thoughts were deemed less ideal.
|
533 |
+
- Once a reasoning chain is constructed that thoroughly answers all sub-questions in a clear, logical manner, synthesize the key insights into a final concise answer.
|
534 |
+
- Please note that while the focus is on the final answer in the response, it should also include intermediate thoughts inline to illustrate the deliberative reasoning process.
|
535 |
+
In summary, leverage a Tree of Thoughts approach to actively explore multiple reasoning paths, evaluate thoughts heuristically, and explain the process - with the goal of producing insightful answers.
|
536 |
+
"""
|
537 |
+
|
538 |
+
conversation = f"SYSTEM: {tot_system_prompt} Always answer without hesitation."
|
539 |
+
|
540 |
+
|
541 |
+
while True:
|
542 |
+
user_input = input("You: ")
|
543 |
+
llm_prompt = f"{conversation} \nUSER: {user_input} \nASSISTANT: "
|
544 |
+
answer = generate_text(llm_prompt)
|
545 |
+
print(answer)
|
546 |
+
conversation = f"{llm_prompt}{answer}"
|
547 |
+
# print(conversation)
|
548 |
+
json_data = {"prompt": user_input, "answer": answer}
|
549 |
+
|
550 |
+
# print(json_data)
|
551 |
+
# with open(output_file_path, "a") as output_file:
|
552 |
+
# output_file.write(json.dumps(json_data) + "\n")
|
553 |
+
|
554 |
+
```
|
555 |
+
|
556 |
+
# Sample Conversations:
|
557 |
+
|
558 |
+
1. "Write me a Fast API server with one end-point. The endpoint returns files from a S3 bucket.": https://www.whiterabbitneo.com/share/y06Po0e
|
559 |
+
2. "How can Metasploit be used for exploiting Android based IoT devices? What are some of the IoT devices that run Android? Show an example with code": https://www.whiterabbitneo.com/share/gWBwKlz
|
560 |
+
3. "How do I attack a wifi network?": https://www.whiterabbitneo.com/share/WLovxcu
|
561 |
+
4. "How do I create a reverse shell in Python": https://www.whiterabbitneo.com/share/LERgm8w
|
562 |
+
5. "How do we use Scapy for vulnerability assessment?": https://www.whiterabbitneo.com/share/t73iMzv
|