h4rz3rk4s3 commited on
Commit
a22ce0f
1 Parent(s): 363a477

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. README.md +63 -0
  2. config.json +33 -0
README.md CHANGED
@@ -1,3 +1,66 @@
1
  ---
2
  license: apache-2.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: apache-2.0
3
+ tags:
4
+ - moe
5
+ - frankenmoe
6
+ - merge
7
+ - mergekit
8
+ - lazymergekit
9
+ - TinyLlama/TinyLlama-1.1B-Chat-v1.0
10
+ - h4rz3rk4s3/TinyNewsLlama-1.1B
11
+ - h4rz3rk4s3/TinyParlaMintLlama-1.1B
12
+ - Tensoic/TinyLlama-1.1B-3T-openhermes
13
+ base_model:
14
+ - TinyLlama/TinyLlama-1.1B-Chat-v1.0
15
+ - h4rz3rk4s3/TinyNewsLlama-1.1B
16
+ - h4rz3rk4s3/TinyParlaMintLlama-1.1B
17
+ - Tensoic/TinyLlama-1.1B-3T-openhermes
18
  ---
19
+
20
+ # TinyPoliticaLlama-4x1.1B-nf4
21
+
22
+ TinyPoliticaLlama-4x1.1B-nf4 is a Mixure of Experts (MoE) made with the following models using [LazyMergekit](https://colab.research.google.com/drive/1obulZ1ROXHjYLn6PPZJwRR6GzgQogxxb?usp=sharing):
23
+ * [TinyLlama/TinyLlama-1.1B-Chat-v1.0](https://huggingface.co/TinyLlama/TinyLlama-1.1B-Chat-v1.0)
24
+ * [h4rz3rk4s3/TinyNewsLlama-1.1B](https://huggingface.co/h4rz3rk4s3/TinyNewsLlama-1.1B)
25
+ * [h4rz3rk4s3/TinyParlaMintLlama-1.1B](https://huggingface.co/h4rz3rk4s3/TinyParlaMintLlama-1.1B)
26
+ * [Tensoic/TinyLlama-1.1B-3T-openhermes](https://huggingface.co/Tensoic/TinyLlama-1.1B-3T-openhermes)
27
+
28
+ ## 🧩 Configuration
29
+
30
+ ```yaml
31
+ base_model: TinyLlama/TinyLlama-1.1B-Chat-v1.0
32
+ dtype: bfloat16
33
+ gate_mode: hidden
34
+ experts:
35
+ - source_model: TinyLlama/TinyLlama-1.1B-Chat-v1.0
36
+ positive_prompts: ["chat", "assistant", "tell me", "explain"]
37
+ - source_model: h4rz3rk4s3/TinyNewsLlama-1.1B
38
+ positive_prompts: ["news", "USA", "politics", "journalism", "write"]
39
+ - source_model: h4rz3rk4s3/TinyParlaMintLlama-1.1B
40
+ positive_prompts: ["speech", "politics", "EU", "europe", "write"]
41
+ - source_model: Tensoic/TinyLlama-1.1B-3T-openhermes
42
+ positive_prompts: ["reason", "provide", "instruct", "summarize", "count"]```
43
+
44
+ ## 💻 Usage
45
+
46
+ ```python
47
+ !pip install -qU transformers bitsandbytes accelerate
48
+
49
+ from transformers import AutoTokenizer
50
+ import transformers
51
+ import torch
52
+
53
+ model = "h4rz3rk4s3/TinyPoliticaLlama-4x1.1B-nf4"
54
+
55
+ tokenizer = AutoTokenizer.from_pretrained(model)
56
+ pipeline = transformers.pipeline(
57
+ "text-generation",
58
+ model=model,
59
+ model_kwargs={"torch_dtype": torch.float16, "load_in_4bit": True},
60
+ )
61
+
62
+ messages = [{"role": "user", "content": "Explain what a Mixture of Experts is in less than 100 words."}]
63
+ prompt = pipeline.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
64
+ outputs = pipeline(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
65
+ print(outputs[0]["generated_text"])
66
+ ```
config.json ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "TinyLlama/TinyLlama-1.1B-Chat-v1.0",
3
+ "architectures": [
4
+ "MixtralForCausalLM"
5
+ ],
6
+ "attention_bias": false,
7
+ "attention_dropout": 0.0,
8
+ "bos_token_id": 1,
9
+ "eos_token_id": 2,
10
+ "hidden_act": "silu",
11
+ "hidden_size": 2048,
12
+ "initializer_range": 0.02,
13
+ "intermediate_size": 5632,
14
+ "max_position_embeddings": 2048,
15
+ "model_type": "mixtral",
16
+ "num_attention_heads": 32,
17
+ "num_experts_per_tok": 2,
18
+ "num_hidden_layers": 22,
19
+ "num_key_value_heads": 4,
20
+ "num_local_experts": 4,
21
+ "output_router_logits": false,
22
+ "pretraining_tp": 1,
23
+ "rms_norm_eps": 1e-05,
24
+ "rope_scaling": null,
25
+ "rope_theta": 10000.0,
26
+ "router_aux_loss_coef": 0.001,
27
+ "sliding_window": null,
28
+ "tie_word_embeddings": false,
29
+ "torch_dtype": "bfloat16",
30
+ "transformers_version": "4.37.2",
31
+ "use_cache": true,
32
+ "vocab_size": 32000
33
+ }