ssands1979
commited on
Upload folder using huggingface_hub
Browse files- README.md +64 -0
- config.json +38 -0
README.md
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
tags:
|
4 |
+
- moe
|
5 |
+
- frankenmoe
|
6 |
+
- merge
|
7 |
+
- mergekit
|
8 |
+
- lazymergekit
|
9 |
+
- stabilityai/stablecode-instruct-alpha-3b
|
10 |
+
- stabilityai/stable-code-3b
|
11 |
+
base_model:
|
12 |
+
- stabilityai/stablecode-instruct-alpha-3b
|
13 |
+
- stabilityai/stable-code-3b
|
14 |
+
---
|
15 |
+
|
16 |
+
# FrankenStable-3Bx3
|
17 |
+
|
18 |
+
FrankenStable-3Bx3 is a Mixure of Experts (MoE) made with the following models using [LazyMergekit](https://colab.research.google.com/drive/1obulZ1ROXHjYLn6PPZJwRR6GzgQogxxb?usp=sharing):
|
19 |
+
* [stabilityai/stablecode-instruct-alpha-3b](https://huggingface.co/stabilityai/stablecode-instruct-alpha-3b)
|
20 |
+
* [stabilityai/stable-code-3b](https://huggingface.co/stabilityai/stable-code-3b)
|
21 |
+
|
22 |
+
## 🧩 Configuration
|
23 |
+
|
24 |
+
```yaml
|
25 |
+
base_model: stabilityai/stablelm-zephyr-3b
|
26 |
+
experts:
|
27 |
+
- source_model: stabilityai/stablecode-instruct-alpha-3b
|
28 |
+
positive_prompts:
|
29 |
+
- "chat"
|
30 |
+
- "assistant"
|
31 |
+
- "tell me"
|
32 |
+
- "explain"
|
33 |
+
- source_model: stabilityai/stable-code-3b
|
34 |
+
positive_prompts:
|
35 |
+
- "code"
|
36 |
+
- "python"
|
37 |
+
- "javascript"
|
38 |
+
- "programming"
|
39 |
+
- "algorithm"
|
40 |
+
```
|
41 |
+
|
42 |
+
## 💻 Usage
|
43 |
+
|
44 |
+
```python
|
45 |
+
!pip install -qU transformers bitsandbytes accelerate
|
46 |
+
|
47 |
+
from transformers import AutoTokenizer
|
48 |
+
import transformers
|
49 |
+
import torch
|
50 |
+
|
51 |
+
model = "ssands1979/FrankenStable-3Bx3"
|
52 |
+
|
53 |
+
tokenizer = AutoTokenizer.from_pretrained(model)
|
54 |
+
pipeline = transformers.pipeline(
|
55 |
+
"text-generation",
|
56 |
+
model=model,
|
57 |
+
model_kwargs={"torch_dtype": torch.float16, "load_in_4bit": True},
|
58 |
+
)
|
59 |
+
|
60 |
+
messages = [{"role": "user", "content": "Explain what a Mixture of Experts is in less than 100 words."}]
|
61 |
+
prompt = pipeline.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
62 |
+
outputs = pipeline(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
|
63 |
+
print(outputs[0]["generated_text"])
|
64 |
+
```
|
config.json
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "stabilityai/stablelm-zephyr-3b",
|
3 |
+
"architectures": [
|
4 |
+
"MixtralForCausalLM"
|
5 |
+
],
|
6 |
+
"attention_dropout": 0.0,
|
7 |
+
"auto_map": {
|
8 |
+
"AutoConfig": "stabilityai/stablelm-zephyr-3b--configuration_stablelm_epoch.StableLMEpochConfig",
|
9 |
+
"AutoModelForCausalLM": "stabilityai/stablelm-zephyr-3b--modeling_stablelm_epoch.StableLMEpochForCausalLM"
|
10 |
+
},
|
11 |
+
"bos_token_id": 0,
|
12 |
+
"eos_token_id": 0,
|
13 |
+
"hidden_act": "silu",
|
14 |
+
"hidden_size": 2560,
|
15 |
+
"initializer_range": 0.02,
|
16 |
+
"intermediate_size": 6912,
|
17 |
+
"max_position_embeddings": 4096,
|
18 |
+
"model_type": "mixtral",
|
19 |
+
"norm_eps": 1e-05,
|
20 |
+
"num_attention_heads": 32,
|
21 |
+
"num_experts_per_tok": 2,
|
22 |
+
"num_heads": 32,
|
23 |
+
"num_hidden_layers": 32,
|
24 |
+
"num_key_value_heads": 32,
|
25 |
+
"num_local_experts": 2,
|
26 |
+
"output_router_logits": false,
|
27 |
+
"rms_norm_eps": 1e-06,
|
28 |
+
"rope_pct": 0.25,
|
29 |
+
"rope_theta": 10000,
|
30 |
+
"rotary_scaling_factor": 1.0,
|
31 |
+
"router_aux_loss_coef": 0.001,
|
32 |
+
"sliding_window": null,
|
33 |
+
"tie_word_embeddings": false,
|
34 |
+
"torch_dtype": "bfloat16",
|
35 |
+
"transformers_version": "4.37.0",
|
36 |
+
"use_cache": true,
|
37 |
+
"vocab_size": 50304
|
38 |
+
}
|