Update README.md
Browse files
README.md
CHANGED
|
@@ -12,19 +12,100 @@ tags:
|
|
| 12 |
- devops
|
| 13 |
---
|
| 14 |
|
| 15 |
-

|
| 16 |
-
|
| 17 |
<br>
|
| 18 |
|
| 19 |
# WhiteRabbitNeo
|
| 20 |
|
| 21 |
-
|
|
|
|
|
|
|
| 22 |
|
|
|
|
| 23 |
|
| 24 |
# Community
|
| 25 |
|
| 26 |
Join us on [Discord](https://discord.gg/8Ynkrcbk92)
|
| 27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
# License
|
| 29 |
|
| 30 |
Apache-2.0 + WhiteRabbitNeo Extended Version
|
|
|
|
| 12 |
- devops
|
| 13 |
---
|
| 14 |
|
|
|
|
|
|
|
| 15 |
<br>
|
| 16 |
|
| 17 |
# WhiteRabbitNeo
|
| 18 |
|
| 19 |
+
<br>
|
| 20 |
+
|
| 21 |
+

|
| 22 |
|
| 23 |
+
WhiteRabbitNeo is a model series that can be used for offensive and defensive cybersecurity. Access at [whiterabbitneo.com](https://www.whiterabbitneo.com/) or go to [Kindo.ai](https://www.kindo.ai/) to create agents.
|
| 24 |
|
| 25 |
# Community
|
| 26 |
|
| 27 |
Join us on [Discord](https://discord.gg/8Ynkrcbk92)
|
| 28 |
|
| 29 |
+
|
| 30 |
+
# Technical Overview
|
| 31 |
+
|
| 32 |
+
WhiteRabbitNeo is a finetune of [Qwen2.5-Coder-7B](https://huggingface.co/Qwen/Qwen2.5-Coder-7B/), and inherits the following features:
|
| 33 |
+
- Type: Causal Language Models
|
| 34 |
+
- Training Stage: Pretraining & Post-training
|
| 35 |
+
- Architecture: transformers with RoPE, SwiGLU, RMSNorm, and Attention QKV bias
|
| 36 |
+
- Number of Parameters: 7.61B
|
| 37 |
+
- Number of Paramaters (Non-Embedding): 6.53B
|
| 38 |
+
- Number of Layers: 28
|
| 39 |
+
- Number of Attention Heads (GQA): 28 for Q and 4 for KV
|
| 40 |
+
- Context Length: Full 131,072 tokens
|
| 41 |
+
- Please refer to [this section](#processing-long-texts) for detailed instructions on how to deploy Qwen2.5 for handling long texts.
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
## Requirements
|
| 45 |
+
|
| 46 |
+
We advise you to use the latest version of `transformers`.
|
| 47 |
+
|
| 48 |
+
With `transformers<4.37.0`, you will encounter the following error:
|
| 49 |
+
```
|
| 50 |
+
KeyError: 'qwen2'
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
## Quickstart
|
| 54 |
+
|
| 55 |
+
Here provides a code snippet with `apply_chat_template` to show you how to load the tokenizer and model and how to generate contents.
|
| 56 |
+
|
| 57 |
+
```python
|
| 58 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 59 |
+
|
| 60 |
+
model_name = "WhiteRabbitNeo/WhiteRabbitNeo-V3-7B"
|
| 61 |
+
|
| 62 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 63 |
+
model_name,
|
| 64 |
+
torch_dtype="auto",
|
| 65 |
+
device_map="auto"
|
| 66 |
+
)
|
| 67 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 68 |
+
|
| 69 |
+
prompt = "write a quick sort algorithm."
|
| 70 |
+
messages = [
|
| 71 |
+
{"role": "system", "content": "You are WhiteRabbitNeo, created by Kindo.ai. You are a helpful assistant that is an expert in Cybersecurity and DevOps."},
|
| 72 |
+
{"role": "user", "content": prompt}
|
| 73 |
+
]
|
| 74 |
+
text = tokenizer.apply_chat_template(
|
| 75 |
+
messages,
|
| 76 |
+
tokenize=False,
|
| 77 |
+
add_generation_prompt=True
|
| 78 |
+
)
|
| 79 |
+
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
|
| 80 |
+
|
| 81 |
+
generated_ids = model.generate(
|
| 82 |
+
**model_inputs,
|
| 83 |
+
max_new_tokens=512
|
| 84 |
+
)
|
| 85 |
+
generated_ids = [
|
| 86 |
+
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
|
| 87 |
+
]
|
| 88 |
+
|
| 89 |
+
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
| 90 |
+
```
|
| 91 |
+
|
| 92 |
+
### Processing Long Texts
|
| 93 |
+
|
| 94 |
+
The current `config.json` is set for context length up to 32,768 tokens.
|
| 95 |
+
To handle extensive inputs exceeding 32,768 tokens, we utilize [YaRN](https://arxiv.org/abs/2309.00071), a technique for enhancing model length extrapolation, ensuring optimal performance on lengthy texts.
|
| 96 |
+
|
| 97 |
+
For supported frameworks, you could add the following to `config.json` to enable YaRN:
|
| 98 |
+
```json
|
| 99 |
+
{
|
| 100 |
+
...,
|
| 101 |
+
"rope_scaling": {
|
| 102 |
+
"factor": 4.0,
|
| 103 |
+
"original_max_position_embeddings": 32768,
|
| 104 |
+
"type": "yarn"
|
| 105 |
+
}
|
| 106 |
+
}
|
| 107 |
+
```
|
| 108 |
+
|
| 109 |
# License
|
| 110 |
|
| 111 |
Apache-2.0 + WhiteRabbitNeo Extended Version
|