Upload folder using huggingface_hub
Browse files- README.md +83 -0
- config.json +46 -0
README.md
ADDED
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
base_model:
|
4 |
+
- Trelis/Llama-3.2-1B-Instruct-MATH-3ep
|
5 |
+
- huihui-ai/Llama-3.2-1B-Instruct-abliterated
|
6 |
+
- passing2961/Ultron-Summarizer-1B
|
7 |
+
- unsloth/Llama-3.2-1B-Instruct
|
8 |
+
tags:
|
9 |
+
- moe
|
10 |
+
- frankenmoe
|
11 |
+
- merge
|
12 |
+
- mergekit
|
13 |
+
- lazymergekit
|
14 |
+
- Trelis/Llama-3.2-1B-Instruct-MATH-3ep
|
15 |
+
- huihui-ai/Llama-3.2-1B-Instruct-abliterated
|
16 |
+
- passing2961/Ultron-Summarizer-1B
|
17 |
+
- unsloth/Llama-3.2-1B-Instruct
|
18 |
+
---
|
19 |
+
|
20 |
+
# DaRuukLLM-Refresh-4x1B-v1
|
21 |
+
|
22 |
+
DaRuukLLM-Refresh-4x1B-v1 is a Mixure of Experts (MoE) made with the following models using [LazyMergekit](https://colab.research.google.com/drive/1obulZ1ROXHjYLn6PPZJwRR6GzgQogxxb?usp=sharing):
|
23 |
+
* [Trelis/Llama-3.2-1B-Instruct-MATH-3ep](https://huggingface.co/Trelis/Llama-3.2-1B-Instruct-MATH-3ep)
|
24 |
+
* [huihui-ai/Llama-3.2-1B-Instruct-abliterated](https://huggingface.co/huihui-ai/Llama-3.2-1B-Instruct-abliterated)
|
25 |
+
* [passing2961/Ultron-Summarizer-1B](https://huggingface.co/passing2961/Ultron-Summarizer-1B)
|
26 |
+
* [unsloth/Llama-3.2-1B-Instruct](https://huggingface.co/unsloth/Llama-3.2-1B-Instruct)
|
27 |
+
|
28 |
+
## 🧩 Configuration
|
29 |
+
|
30 |
+
```yaml
|
31 |
+
base_model: unsloth/Llama-3.2-1B-Instruct # Base model for self-attention and layer normalization
|
32 |
+
gate_mode: hidden # Use hidden state representations for MoE gate parameters
|
33 |
+
dtype: bfloat16 # Output data type for the merged model
|
34 |
+
|
35 |
+
experts:
|
36 |
+
- source_model: Trelis/Llama-3.2-1B-Instruct-MATH-3ep # Expert for math-related tasks
|
37 |
+
positive_prompts:
|
38 |
+
- "Solve the following math problem:"
|
39 |
+
- "Calculate the value of:"
|
40 |
+
- "What is the result of:"
|
41 |
+
|
42 |
+
- source_model: huihui-ai/Llama-3.2-1B-Instruct-abliterated # Expert for uncensored queries
|
43 |
+
positive_prompts:
|
44 |
+
- "Explain the following controversial topic:"
|
45 |
+
- "Discuss the implications of:"
|
46 |
+
- "Provide an uncensored analysis of:"
|
47 |
+
|
48 |
+
- source_model: passing2961/Ultron-Summarizer-1B # Expert for summarization tasks
|
49 |
+
positive_prompts:
|
50 |
+
- "Summarize the following text:"
|
51 |
+
- "Provide a concise summary of:"
|
52 |
+
- "Generate a brief overview of:"
|
53 |
+
|
54 |
+
- source_model: unsloth/Llama-3.2-1B-Instruct # Base model also acts as the chat expert
|
55 |
+
positive_prompts:
|
56 |
+
- "How can I assist you today?"
|
57 |
+
- "What would you like to discuss?"
|
58 |
+
- "Let's have a conversation about:"
|
59 |
+
```
|
60 |
+
|
61 |
+
## 💻 Usage
|
62 |
+
|
63 |
+
```python
|
64 |
+
!pip install -qU transformers bitsandbytes accelerate
|
65 |
+
|
66 |
+
from transformers import AutoTokenizer
|
67 |
+
import transformers
|
68 |
+
import torch
|
69 |
+
|
70 |
+
model = "Xiaojian9992024/DaRuukLLM-Refresh-4x1B-v1"
|
71 |
+
|
72 |
+
tokenizer = AutoTokenizer.from_pretrained(model)
|
73 |
+
pipeline = transformers.pipeline(
|
74 |
+
"text-generation",
|
75 |
+
model=model,
|
76 |
+
model_kwargs={"torch_dtype": torch.float16, "load_in_4bit": True},
|
77 |
+
)
|
78 |
+
|
79 |
+
messages = [{"role": "user", "content": "Explain what a Mixture of Experts is in less than 100 words."}]
|
80 |
+
prompt = pipeline.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
81 |
+
outputs = pipeline(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
|
82 |
+
print(outputs[0]["generated_text"])
|
83 |
+
```
|
config.json
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "unsloth/Llama-3.2-1B-Instruct",
|
3 |
+
"architectures": [
|
4 |
+
"MixtralForCausalLM"
|
5 |
+
],
|
6 |
+
"attention_bias": false,
|
7 |
+
"attention_dropout": 0.0,
|
8 |
+
"bos_token_id": 128000,
|
9 |
+
"eos_token_id": [
|
10 |
+
128001,
|
11 |
+
128008,
|
12 |
+
128009
|
13 |
+
],
|
14 |
+
"head_dim": 64,
|
15 |
+
"hidden_act": "silu",
|
16 |
+
"hidden_size": 2048,
|
17 |
+
"initializer_range": 0.02,
|
18 |
+
"intermediate_size": 8192,
|
19 |
+
"max_position_embeddings": 131072,
|
20 |
+
"mlp_bias": false,
|
21 |
+
"model_type": "mixtral",
|
22 |
+
"num_attention_heads": 32,
|
23 |
+
"num_experts_per_tok": 2,
|
24 |
+
"num_hidden_layers": 16,
|
25 |
+
"num_key_value_heads": 8,
|
26 |
+
"num_local_experts": 4,
|
27 |
+
"output_router_logits": false,
|
28 |
+
"pretraining_tp": 1,
|
29 |
+
"rms_norm_eps": 1e-05,
|
30 |
+
"rope_scaling": {
|
31 |
+
"factor": 32.0,
|
32 |
+
"high_freq_factor": 4.0,
|
33 |
+
"low_freq_factor": 1.0,
|
34 |
+
"original_max_position_embeddings": 8192,
|
35 |
+
"rope_type": "llama3"
|
36 |
+
},
|
37 |
+
"rope_theta": 500000.0,
|
38 |
+
"router_aux_loss_coef": 0.001,
|
39 |
+
"router_jitter_noise": 0.0,
|
40 |
+
"sliding_window": null,
|
41 |
+
"tie_word_embeddings": true,
|
42 |
+
"torch_dtype": "bfloat16",
|
43 |
+
"transformers_version": "4.48.0",
|
44 |
+
"use_cache": true,
|
45 |
+
"vocab_size": 128256
|
46 |
+
}
|