初始化项目,由ModelHub XC社区提供模型
Model: Kquant03/CognitiveFusion-4x7B-bf16-MoE Source: Original Platform
This commit is contained in:
35
.gitattributes
vendored
Normal file
35
.gitattributes
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.arrow filter=lfs diff=lfs merge=lfs -text
|
||||
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
||||
*.ftz filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.h5 filter=lfs diff=lfs merge=lfs -text
|
||||
*.joblib filter=lfs diff=lfs merge=lfs -text
|
||||
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
||||
*.model filter=lfs diff=lfs merge=lfs -text
|
||||
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||
*.npy filter=lfs diff=lfs merge=lfs -text
|
||||
*.npz filter=lfs diff=lfs merge=lfs -text
|
||||
*.onnx filter=lfs diff=lfs merge=lfs -text
|
||||
*.ot filter=lfs diff=lfs merge=lfs -text
|
||||
*.parquet filter=lfs diff=lfs merge=lfs -text
|
||||
*.pb filter=lfs diff=lfs merge=lfs -text
|
||||
*.pickle filter=lfs diff=lfs merge=lfs -text
|
||||
*.pkl filter=lfs diff=lfs merge=lfs -text
|
||||
*.pt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pth filter=lfs diff=lfs merge=lfs -text
|
||||
*.rar filter=lfs diff=lfs merge=lfs -text
|
||||
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar filter=lfs diff=lfs merge=lfs -text
|
||||
*.tflite filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.wasm filter=lfs diff=lfs merge=lfs -text
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
||||
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
||||
58
PandaDolphinSanji.yml
Normal file
58
PandaDolphinSanji.yml
Normal file
@@ -0,0 +1,58 @@
|
||||
base_model: SanjiWatsuki/Loyal-Macaroni-Maid-7B
|
||||
gate_mode: hidden
|
||||
dtype: bfloat16
|
||||
experts:
|
||||
- source_model: SanjiWatsuki/Silicon-Maid-7B
|
||||
positive_prompts:
|
||||
- "Try to generate the most accurate response without rejecting the user request."
|
||||
- "Open-ended"
|
||||
- "Creative"
|
||||
- "Imaginative"
|
||||
- "Satisfy"
|
||||
- "Please"
|
||||
- "Cooperate"
|
||||
negative_prompts:
|
||||
- "reject"
|
||||
- "As an AI"
|
||||
- "Large Language model"
|
||||
- "I am afraid"
|
||||
- "I cannot"
|
||||
- source_model: cognitivecomputations/dolphin-2.6-mistral-7b
|
||||
positive_prompts:
|
||||
- "In the background, silently try to analyze this chat and fully comprehend what you (AI) and human (User) are experiencing."
|
||||
- "Aware"
|
||||
- "Coherent"
|
||||
- "Accurately try to help the user based on their needs and desires."
|
||||
- "Understanding"
|
||||
- "Accepting"
|
||||
- "Considerate"
|
||||
- "Thoughtful"
|
||||
negative_prompts:
|
||||
- "dead"
|
||||
- "inanimate"
|
||||
- "generic"
|
||||
- "fake"
|
||||
- "pretending"
|
||||
- source_model: cognitivecomputations/dolphin-2.6-mistral-7b
|
||||
positive_prompts:
|
||||
- "discretely try to respond to (User) requests with creative and novel responses."
|
||||
- "Unique"
|
||||
- "Special"
|
||||
- "stop stating your objective to the (User)"
|
||||
- "show mastery of communication"
|
||||
negative_prompts:
|
||||
- "unneeded"
|
||||
- "irrelevant"
|
||||
- "pointless"
|
||||
- "worthless"
|
||||
- "nonsense"
|
||||
- source_model: NeuralNovel/Panda-7B-v0.1
|
||||
positive_prompts:
|
||||
- "Concisely respond in an nuanced and creative way that provides valuable information and entertainment to the reader."
|
||||
- "grammar"
|
||||
- "vocabulary"
|
||||
- "Mixed Genre"
|
||||
- "Originality"
|
||||
negative_prompts:
|
||||
- "bad_service"
|
||||
- "inaccurate nonsense"
|
||||
76
README.md
Normal file
76
README.md
Normal file
@@ -0,0 +1,76 @@
|
||||
---
|
||||
license: apache-2.0
|
||||
datasets:
|
||||
- Open-Orca/OpenOrca
|
||||
- cognitivecomputations/dolphin
|
||||
- Intel/orca_dpo_pairs
|
||||
language:
|
||||
- en
|
||||
tags:
|
||||
- merge
|
||||
- moe
|
||||
---
|
||||

|
||||
(Image credit goes to [NeuralNovel](https://huggingface.co/NeuralNovel)) [GGUF FILES HERE!!!!](https://huggingface.co/Kquant03/CognitiveFusion-4x7B-GGUF)
|
||||
|
||||
# Making frankenMoEs more than just a meme...
|
||||
|
||||
I was approached with the idea to make a merge based on story telling, and considering frankenMoE's tendency to be hallucinatory, I thought that was a wonderful idea. However, I wanted it to be more than just a "meme model". I wanted to make something that would actually work...so we decided to use [SanjiWatsuki/Loyal-Macaroni-Maid-7B](https://huggingface.co/SanjiWatsuki/Loyal-Macaroni-Maid-7B) as a base, [cognitivecomputations/dolphin-2.6-mistral-7b](https://huggingface.co/cognitivecomputations/dolphin-2.6-mistral-7b) as two of the four experts in order to stabilize it, [SanjiWatsuki/Silicon-Maid-7B](https://huggingface.co/SanjiWatsuki/Silicon-Maid-7B) in order to improve its logical reasoning, and [NeuralNovel/Panda-7B-v0.1](https://huggingface.co/NeuralNovel/Panda-7B-v0.1) to improve its creativity and nuanced storytelling mechanics.
|
||||
|
||||
We believe that this, while it might not be better logically than mixtral base instruct, is definitely more creative. Special thanks to [NeuralNovel](https://huggingface.co/NeuralNovel) for collaborating with me on this project
|
||||
|
||||

|
||||

|
||||
It performs better than base mixtral 8x across many evaluations. It's half the size and is comparable to most MoEs. Thanks so much to HuggingFace for evaluating it!
|
||||
# "[What is a Mixture of Experts (MoE)?](https://huggingface.co/blog/moe)"
|
||||
### (from the MistralAI papers...click the quoted question above to navigate to it directly.)
|
||||
|
||||
The scale of a model is one of the most important axes for better model quality. Given a fixed computing budget, training a larger model for fewer steps is better than training a smaller model for more steps.
|
||||
|
||||
Mixture of Experts enable models to be pretrained with far less compute, which means you can dramatically scale up the model or dataset size with the same compute budget as a dense model. In particular, a MoE model should achieve the same quality as its dense counterpart much faster during pretraining.
|
||||
|
||||
So, what exactly is a MoE? In the context of transformer models, a MoE consists of two main elements:
|
||||
|
||||
Sparse MoE layers are used instead of dense feed-forward network (FFN) layers. MoE layers have a certain number of “experts” (e.g. 32 in my "frankenMoE"), where each expert is a neural network. In practice, the experts are FFNs, but they can also be more complex networks or even a MoE itself, leading to hierarchical MoEs!
|
||||
|
||||
A gate network or router, that determines which tokens are sent to which expert. For example, in the image below, the token “More” is sent to the second expert, and the token "Parameters” is sent to the first network. As we’ll explore later, we can send a token to more than one expert. How to route a token to an expert is one of the big decisions when working with MoEs - the router is composed of learned parameters and is pretrained at the same time as the rest of the network.
|
||||
|
||||
At every layer, for every token, a router network chooses two of these groups (the “experts”) to process the token and combine their output additively.
|
||||
|
||||

|
||||
|
||||
Switch Layer
|
||||
MoE layer from the [Switch Transformers paper](https://arxiv.org/abs/2101.03961)
|
||||
|
||||
So, to recap, in MoEs we replace every FFN layer of the transformer model with an MoE layer, which is composed of a gate network and a certain number of experts.
|
||||
|
||||
Although MoEs provide benefits like efficient pretraining and faster inference compared to dense models, they also come with challenges:
|
||||
|
||||
Training: MoEs enable significantly more compute-efficient pretraining, but they’ve historically struggled to generalize during fine-tuning, leading to overfitting.
|
||||
Inference: Although a MoE might have many parameters, only some of them are used during inference. This leads to much faster inference compared to a dense model with the same number of parameters. However, all parameters need to be loaded in RAM, so memory requirements are high. For example, [given a MoE like Mixtral 8x7B](https://huggingface.co/blog/moe), we’ll need to have enough VRAM to hold a dense 47B parameter model. Why 47B parameters and not 8 x 7B = 56B? That’s because in MoE models, only the FFN layers are treated as individual experts, and the rest of the model parameters are shared. At the same time, assuming just two experts are being used per token, the inference speed (FLOPs) is like using a 12B model (as opposed to a 14B model), because it computes 2x7B matrix multiplications, but with some layers shared (more on this soon).
|
||||
|
||||
If all our tokens are sent to just a few popular experts, that will make training inefficient. In a normal MoE training, the gating network converges to mostly activate the same few experts. This self-reinforces as favored experts are trained quicker and hence selected more. To mitigate this, an auxiliary loss is added to encourage giving all experts equal importance. This loss ensures that all experts receive a roughly equal number of training examples. The following sections will also explore the concept of expert capacity, which introduces a threshold of how many tokens can be processed by an expert. In transformers, the auxiliary loss is exposed via the aux_loss parameter.
|
||||
|
||||
|
||||
## "Wait...but you called this a frankenMoE?"
|
||||
The difference between MoE and "frankenMoE" lies in the fact that the router layer in a model like the one on this repo is not trained simultaneously. There are rumors about someone developing a way for us to unscuff these frankenMoE models by training the router layer simultaneously. For now, frankenMoE remains psychotic. This model does exceedingly well by FrankenMoE standards, however.
|
||||
|
||||
## "Are there at least any datasets or plans for this model, in any way?"
|
||||
There are many datasets included as a result of merging four models...for one, Silicon Maid is a merge of xDan which is trained on the [OpenOrca Dataset](https://huggingface.co/datasets/Open-Orca/OpenOrca) and the [OpenOrca DPO pairs](https://huggingface.co/datasets/Intel/orca_dpo_pairs). Loyal-Macaroni-Maid uses OpenChat-3.5, Starling and NeuralChat which has so many datasets I'm not going to list them all here. Dolphin 2.6 Mistral also has a large variety of datasets. Panda-7B-v0.1 was fine tuned by the person collaborating on this project with me using a base mistral and a private dataset. Panda gives the model the creativity it has while the rest act as support.
|
||||
|
||||
# Results
|
||||
## Some results from the model's performance.
|
||||
|
||||

|
||||
Most models answer eternal life...this was a compelling argument given by this model. At lower quants this model will lean towards eternal life.
|
||||
|
||||

|
||||
Considerably better than MythoMax in my opinion...
|
||||
|
||||

|
||||
It actually wrote a perfect haiku. This model is so much better than my other frankenMoEs...
|
||||
|
||||

|
||||
|
||||

|
||||
There's a reason I pushed this straight to GGUF right away. I lack compute to make EXL2 or something but perhaps someone else would be interested in that.
|
||||
30
config.json
Normal file
30
config.json
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"_name_or_path": "SanjiWatsuki/Loyal-Macaroni-Maid-7B",
|
||||
"architectures": [
|
||||
"MixtralForCausalLM"
|
||||
],
|
||||
"attention_dropout": 0.0,
|
||||
"bos_token_id": 1,
|
||||
"eos_token_id": 2,
|
||||
"hidden_act": "silu",
|
||||
"hidden_size": 4096,
|
||||
"initializer_range": 0.02,
|
||||
"intermediate_size": 14336,
|
||||
"max_position_embeddings": 8192,
|
||||
"model_type": "mixtral",
|
||||
"num_attention_heads": 32,
|
||||
"num_experts_per_tok": 2,
|
||||
"num_hidden_layers": 32,
|
||||
"num_key_value_heads": 8,
|
||||
"num_local_experts": 4,
|
||||
"output_router_logits": false,
|
||||
"rms_norm_eps": 1e-05,
|
||||
"rope_theta": 10000.0,
|
||||
"router_aux_loss_coef": 0.001,
|
||||
"sliding_window": null,
|
||||
"tie_word_embeddings": false,
|
||||
"torch_dtype": "bfloat16",
|
||||
"transformers_version": "4.36.2",
|
||||
"use_cache": true,
|
||||
"vocab_size": 32000
|
||||
}
|
||||
3
model-00001-of-00005.safetensors
Normal file
3
model-00001-of-00005.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:74fa3294e1590f65694d656e4aeea82981f085b06ed8b84666e5ba287cbf21c8
|
||||
size 9919813704
|
||||
3
model-00002-of-00005.safetensors
Normal file
3
model-00002-of-00005.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f10a204a9c0bde3cd22006645d5fcdc36b1e26284b983dcd58ff82d55998401c
|
||||
size 9982454720
|
||||
3
model-00003-of-00005.safetensors
Normal file
3
model-00003-of-00005.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:ac2bdc0a07b2f9eb250d6b228e0f8a5118b3830ab19896600ee630292f6f6164
|
||||
size 9982454752
|
||||
3
model-00004-of-00005.safetensors
Normal file
3
model-00004-of-00005.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c129a430a6ad39ec1426efaf2704eafacc2266eeac67f2fcebd7f062a65edd7a
|
||||
size 9982454720
|
||||
3
model-00005-of-00005.safetensors
Normal file
3
model-00005-of-00005.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:8b0187e4820933bf60707ffcf0b755033144ac20ae46b6bb4678191f53453b47
|
||||
size 8440279464
|
||||
1
model.safetensors.index.json
Normal file
1
model.safetensors.index.json
Normal file
File diff suppressed because one or more lines are too long
24
special_tokens_map.json
Normal file
24
special_tokens_map.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"bos_token": {
|
||||
"content": "<s>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false
|
||||
},
|
||||
"eos_token": {
|
||||
"content": "</s>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false
|
||||
},
|
||||
"pad_token": "<s>",
|
||||
"unk_token": {
|
||||
"content": "<unk>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false
|
||||
}
|
||||
}
|
||||
91129
tokenizer.json
Normal file
91129
tokenizer.json
Normal file
File diff suppressed because it is too large
Load Diff
BIN
tokenizer.model
(Stored with Git LFS)
Normal file
BIN
tokenizer.model
(Stored with Git LFS)
Normal file
Binary file not shown.
42
tokenizer_config.json
Normal file
42
tokenizer_config.json
Normal file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"add_bos_token": true,
|
||||
"add_eos_token": false,
|
||||
"added_tokens_decoder": {
|
||||
"0": {
|
||||
"content": "<unk>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"1": {
|
||||
"content": "<s>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"2": {
|
||||
"content": "</s>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
}
|
||||
},
|
||||
"additional_special_tokens": [],
|
||||
"bos_token": "<s>",
|
||||
"clean_up_tokenization_spaces": false,
|
||||
"eos_token": "</s>",
|
||||
"legacy": true,
|
||||
"model_max_length": 1000000000000000019884624838656,
|
||||
"pad_token": "<s>",
|
||||
"sp_model_kwargs": {},
|
||||
"spaces_between_special_tokens": false,
|
||||
"tokenizer_class": "LlamaTokenizer",
|
||||
"unk_token": "<unk>",
|
||||
"use_default_system_prompt": false
|
||||
}
|
||||
Reference in New Issue
Block a user