初始化项目,由ModelHub XC社区提供模型
Model: M4-ai/TinyMistral-6x248M 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
|
||||||
167
README.md
Normal file
167
README.md
Normal file
@@ -0,0 +1,167 @@
|
|||||||
|
---
|
||||||
|
license: apache-2.0
|
||||||
|
tags:
|
||||||
|
- moe
|
||||||
|
- frankenmoe
|
||||||
|
- merge
|
||||||
|
- mergekit
|
||||||
|
- lazymergekit
|
||||||
|
- Locutusque/TinyMistral-248M-v2
|
||||||
|
- Locutusque/TinyMistral-248M-v2.5
|
||||||
|
- Locutusque/TinyMistral-248M-v2.5-Instruct
|
||||||
|
- jtatman/tinymistral-v2-pycoder-instruct-248m
|
||||||
|
- Felladrin/TinyMistral-248M-SFT-v4
|
||||||
|
- Locutusque/TinyMistral-248M-v2-Instruct
|
||||||
|
base_model:
|
||||||
|
- Locutusque/TinyMistral-248M-v2
|
||||||
|
- Locutusque/TinyMistral-248M-v2.5
|
||||||
|
- Locutusque/TinyMistral-248M-v2.5-Instruct
|
||||||
|
- jtatman/tinymistral-v2-pycoder-instruct-248m
|
||||||
|
- Felladrin/TinyMistral-248M-SFT-v4
|
||||||
|
- Locutusque/TinyMistral-248M-v2-Instruct
|
||||||
|
inference:
|
||||||
|
parameters:
|
||||||
|
do_sample: true
|
||||||
|
temperature: 0.2
|
||||||
|
top_p: 0.14
|
||||||
|
top_k: 12
|
||||||
|
max_new_tokens: 250
|
||||||
|
repetition_penalty: 1.15
|
||||||
|
widget:
|
||||||
|
- text: |
|
||||||
|
<|im_start|>user
|
||||||
|
Write me a Python program that calculates the factorial of n. <|im_end|>
|
||||||
|
<|im_start|>assistant
|
||||||
|
- text: >-
|
||||||
|
An emerging clinical approach to treat substance abuse disorders involves a
|
||||||
|
form of cognitive-behavioral therapy whereby addicts learn to reduce their
|
||||||
|
reactivity to drug-paired stimuli through cue-exposure or extinction
|
||||||
|
training. It is, however,
|
||||||
|
datasets:
|
||||||
|
- nampdn-ai/mini-peS2o
|
||||||
|
---
|
||||||
|
|
||||||
|
# TinyMistral-6x248M
|
||||||
|
|
||||||
|
TinyMistral-6x248M is a Mixure of Experts (MoE) made with the following models using [LazyMergekit](https://colab.research.google.com/drive/1obulZ1ROXHjYLn6PPZJwRR6GzgQogxxb?usp=sharing):
|
||||||
|
* [Locutusque/TinyMistral-248M-v2](https://huggingface.co/Locutusque/TinyMistral-248M-v2)
|
||||||
|
* [Locutusque/TinyMistral-248M-v2.5](https://huggingface.co/Locutusque/TinyMistral-248M-v2.5)
|
||||||
|
* [Locutusque/TinyMistral-248M-v2.5-Instruct](https://huggingface.co/Locutusque/TinyMistral-248M-v2.5-Instruct)
|
||||||
|
* [jtatman/tinymistral-v2-pycoder-instruct-248m](https://huggingface.co/jtatman/tinymistral-v2-pycoder-instruct-248m)
|
||||||
|
* [Felladrin/TinyMistral-248M-SFT-v4](https://huggingface.co/Felladrin/TinyMistral-248M-SFT-v4)
|
||||||
|
* [Locutusque/TinyMistral-248M-v2-Instruct](https://huggingface.co/Locutusque/TinyMistral-248M-v2-Instruct)
|
||||||
|
|
||||||
|
The resulting model is then pre-trained on 600,000 examples of nampdn-ai/mini-peS2o.
|
||||||
|
|
||||||
|
We don't recommend using the Inference API as the model has serious performance degradation.
|
||||||
|
|
||||||
|
### Recommended inference parameters
|
||||||
|
|
||||||
|
```
|
||||||
|
do_sample: true
|
||||||
|
temperature: 0.2
|
||||||
|
top_p: 0.14
|
||||||
|
top_k: 12
|
||||||
|
repetition_penalty: 1.15
|
||||||
|
```
|
||||||
|
|
||||||
|
## 🧩 Configuration
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
base_model: Locutusque/TinyMistral-248M-v2.5
|
||||||
|
experts:
|
||||||
|
- source_model: Locutusque/TinyMistral-248M-v2
|
||||||
|
positive_prompts:
|
||||||
|
- "An emerging trend in global economics is"
|
||||||
|
- "TITLE: The Next Generation of Internet Connectivity"
|
||||||
|
- "begin a comprehensive analysis on the sociopolitical effects of"
|
||||||
|
negative_prompts:
|
||||||
|
- "Code a simple"
|
||||||
|
- "Explain the Krebs cycle in detail"
|
||||||
|
- "Compose a sonnet about"
|
||||||
|
|
||||||
|
- source_model: Locutusque/TinyMistral-248M-v2.5
|
||||||
|
positive_prompts:
|
||||||
|
- "Advanced C++ memory management techniques"
|
||||||
|
- "C# asynchronous programming best practices"
|
||||||
|
- "AI's role in predictive analytics"
|
||||||
|
- "textbook review on machine learning algorithms"
|
||||||
|
- "## Exercise: Design a C# interface for a CRM system"
|
||||||
|
- "## Solution: Optimize an AI-powered recommendation engine"
|
||||||
|
negative_prompts:
|
||||||
|
- "Narrate the story of"
|
||||||
|
- "The ethical considerations in"
|
||||||
|
- "Review the latest art exhibition by"
|
||||||
|
|
||||||
|
- source_model: Locutusque/TinyMistral-248M-v2.5-Instruct
|
||||||
|
positive_prompts:
|
||||||
|
- "What is the chemical formula for photosynthesis?"
|
||||||
|
- "Identification of a new mineral found on Mars"
|
||||||
|
- "physics: Explaining the concept of relativity"
|
||||||
|
- "Solve for x using differential equations:"
|
||||||
|
- "history: Analyze the causes of the French Revolution"
|
||||||
|
negative_prompts:
|
||||||
|
- "Devise a business plan for"
|
||||||
|
- "The evolution of culinary arts"
|
||||||
|
- "Orchestrate a piece for a string quartet"
|
||||||
|
|
||||||
|
- source_model: jtatman/tinymistral-v2-pycoder-instruct-248m
|
||||||
|
positive_prompts:
|
||||||
|
- "Write a Python program for facial recognition"
|
||||||
|
- "Explain dynamic typing in programming languages"
|
||||||
|
- "algorithm development for efficient data sorting"
|
||||||
|
negative_prompts:
|
||||||
|
- "Who was the first Emperor of Rome?"
|
||||||
|
- "Discuss the political dynamics in"
|
||||||
|
- "Provide a proof for Fermat's Last Theorem"
|
||||||
|
- "physics: The principles of thermodynamics"
|
||||||
|
|
||||||
|
- source_model: Felladrin/TinyMistral-248M-SFT-v4
|
||||||
|
positive_prompts:
|
||||||
|
- "Escreba sobre a influência da música no Brasil"
|
||||||
|
- "Voici un guide pour les voyageurs en France"
|
||||||
|
- "Para entender la política de México, se debe considerar"
|
||||||
|
- "Cuales son los efectos de la globalización en Argentina"
|
||||||
|
- "Welche gesellschaftlichen Veränderungen gibt es in Deutschland"
|
||||||
|
- "If you had to imagine a utopian city, what would be its core values?"
|
||||||
|
negative_prompts:
|
||||||
|
- "Calculate the integral of"
|
||||||
|
- "Describe the process of cell division"
|
||||||
|
- "Review the latest advancements in quantum computing"
|
||||||
|
|
||||||
|
- source_model: Locutusque/TinyMistral-248M-v2-Instruct
|
||||||
|
positive_prompts:
|
||||||
|
- "Write an essay on the evolution of international trade laws"
|
||||||
|
- "What are the key components of a sustainable urban ecosystem?"
|
||||||
|
- "instruct on effective negotiation techniques in diplomacy"
|
||||||
|
- "How does cognitive bias affect decision making in high-pressure environments?"
|
||||||
|
- "Identify the architectural significance of the Sydney Opera House"
|
||||||
|
negative_prompts:
|
||||||
|
- "Develop a script to automate"
|
||||||
|
- "Understanding inheritance in object-oriented programming"
|
||||||
|
- "philosophy of existentialism in contemporary society"
|
||||||
|
```
|
||||||
|
|
||||||
|
## 💻 Usage
|
||||||
|
|
||||||
|
```python
|
||||||
|
!pip install -qU transformers bitsandbytes accelerate
|
||||||
|
|
||||||
|
from transformers import AutoTokenizer
|
||||||
|
import transformers
|
||||||
|
import torch
|
||||||
|
|
||||||
|
model = "M4-ai/TinyMistral-6x248M"
|
||||||
|
|
||||||
|
tokenizer = AutoTokenizer.from_pretrained(model)
|
||||||
|
pipeline = transformers.pipeline(
|
||||||
|
"text-generation",
|
||||||
|
model=model,
|
||||||
|
model_kwargs={"torch_dtype": torch.float16, "load_in_4bit": True},
|
||||||
|
)
|
||||||
|
|
||||||
|
messages = [{"role": "user", "content": "Explain what a Mixture of Experts is in less than 100 words."}]
|
||||||
|
prompt = pipeline.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
||||||
|
outputs = pipeline(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
|
||||||
|
print(outputs[0]["generated_text"])
|
||||||
|
```
|
||||||
30
config.json
Normal file
30
config.json
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"_name_or_path": "/media/sebastian/T7/Projects/saved_models",
|
||||||
|
"architectures": [
|
||||||
|
"MixtralForCausalLM"
|
||||||
|
],
|
||||||
|
"attention_dropout": 0.0,
|
||||||
|
"bos_token_id": 1,
|
||||||
|
"eos_token_id": 2,
|
||||||
|
"hidden_act": "silu",
|
||||||
|
"hidden_size": 1024,
|
||||||
|
"initializer_range": 0.02,
|
||||||
|
"intermediate_size": 4096,
|
||||||
|
"max_position_embeddings": 32768,
|
||||||
|
"model_type": "mixtral",
|
||||||
|
"num_attention_heads": 32,
|
||||||
|
"num_experts_per_tok": 2,
|
||||||
|
"num_hidden_layers": 12,
|
||||||
|
"num_key_value_heads": 8,
|
||||||
|
"num_local_experts": 6,
|
||||||
|
"output_router_logits": false,
|
||||||
|
"rms_norm_eps": 1e-06,
|
||||||
|
"rope_theta": 10000.0,
|
||||||
|
"router_aux_loss_coef": 0.001,
|
||||||
|
"sliding_window": null,
|
||||||
|
"tie_word_embeddings": false,
|
||||||
|
"torch_dtype": "float32",
|
||||||
|
"transformers_version": "4.36.2",
|
||||||
|
"use_cache": true,
|
||||||
|
"vocab_size": 32005
|
||||||
|
}
|
||||||
6
generation_config.json
Normal file
6
generation_config.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"_from_model_config": true,
|
||||||
|
"bos_token_id": 1,
|
||||||
|
"eos_token_id": 2,
|
||||||
|
"transformers_version": "4.36.2"
|
||||||
|
}
|
||||||
73
mergekit_moe_config.yml
Normal file
73
mergekit_moe_config.yml
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
|
||||||
|
base_model: Locutusque/TinyMistral-248M-v2.5
|
||||||
|
experts:
|
||||||
|
- source_model: Locutusque/TinyMistral-248M-v2
|
||||||
|
positive_prompts:
|
||||||
|
- "An emerging trend in global economics is"
|
||||||
|
- "TITLE: The Next Generation of Internet Connectivity"
|
||||||
|
- "begin a comprehensive analysis on the sociopolitical effects of"
|
||||||
|
negative_prompts:
|
||||||
|
- "Code a simple"
|
||||||
|
- "Explain the Krebs cycle in detail"
|
||||||
|
- "Compose a sonnet about"
|
||||||
|
|
||||||
|
- source_model: Locutusque/TinyMistral-248M-v2.5
|
||||||
|
positive_prompts:
|
||||||
|
- "Advanced C++ memory management techniques"
|
||||||
|
- "C# asynchronous programming best practices"
|
||||||
|
- "AI's role in predictive analytics"
|
||||||
|
- "textbook review on machine learning algorithms"
|
||||||
|
- "## Exercise: Design a C# interface for a CRM system"
|
||||||
|
- "## Solution: Optimize an AI-powered recommendation engine"
|
||||||
|
negative_prompts:
|
||||||
|
- "Narrate the story of"
|
||||||
|
- "The ethical considerations in"
|
||||||
|
- "Review the latest art exhibition by"
|
||||||
|
|
||||||
|
- source_model: Locutusque/TinyMistral-248M-v2.5-Instruct
|
||||||
|
positive_prompts:
|
||||||
|
- "What is the chemical formula for photosynthesis?"
|
||||||
|
- "Identification of a new mineral found on Mars"
|
||||||
|
- "physics: Explaining the concept of relativity"
|
||||||
|
- "Solve for x using differential equations:"
|
||||||
|
- "history: Analyze the causes of the French Revolution"
|
||||||
|
negative_prompts:
|
||||||
|
- "Devise a business plan for"
|
||||||
|
- "The evolution of culinary arts"
|
||||||
|
- "Orchestrate a piece for a string quartet"
|
||||||
|
|
||||||
|
- source_model: jtatman/tinymistral-v2-pycoder-instruct-248m
|
||||||
|
positive_prompts:
|
||||||
|
- "Write a Python program for facial recognition"
|
||||||
|
- "Explain dynamic typing in programming languages"
|
||||||
|
- "algorithm development for efficient data sorting"
|
||||||
|
negative_prompts:
|
||||||
|
- "Who was the first Emperor of Rome?"
|
||||||
|
- "Discuss the political dynamics in"
|
||||||
|
- "Provide a proof for Fermat's Last Theorem"
|
||||||
|
- "physics: The principles of thermodynamics"
|
||||||
|
|
||||||
|
- source_model: Felladrin/TinyMistral-248M-SFT-v4
|
||||||
|
positive_prompts:
|
||||||
|
- "Escreba sobre a influência da música no Brasil"
|
||||||
|
- "Voici un guide pour les voyageurs en France"
|
||||||
|
- "Para entender la política de México, se debe considerar"
|
||||||
|
- "Cuales son los efectos de la globalización en Argentina"
|
||||||
|
- "Welche gesellschaftlichen Veränderungen gibt es in Deutschland"
|
||||||
|
- "If you had to imagine a utopian city, what would be its core values?"
|
||||||
|
negative_prompts:
|
||||||
|
- "Calculate the integral of"
|
||||||
|
- "Describe the process of cell division"
|
||||||
|
- "Review the latest advancements in quantum computing"
|
||||||
|
|
||||||
|
- source_model: Locutusque/TinyMistral-248M-v2-Instruct
|
||||||
|
positive_prompts:
|
||||||
|
- "Write an essay on the evolution of international trade laws"
|
||||||
|
- "What are the key components of a sustainable urban ecosystem?"
|
||||||
|
- "instruct on effective negotiation techniques in diplomacy"
|
||||||
|
- "How does cognitive bias affect decision making in high-pressure environments?"
|
||||||
|
- "Identify the architectural significance of the Sydney Opera House"
|
||||||
|
negative_prompts:
|
||||||
|
- "Develop a script to automate"
|
||||||
|
- "Understanding inheritance in object-oriented programming"
|
||||||
|
- "philosophy of existentialism in contemporary society"
|
||||||
3
model.safetensors
Normal file
3
model.safetensors
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:643390caf77542ac81aa6756dc908473226f383fe59a7b5eeab8f085bf0a551b
|
||||||
|
size 4012327872
|
||||||
30
special_tokens_map.json
Normal file
30
special_tokens_map.json
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"bos_token": {
|
||||||
|
"content": "<|bos|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false
|
||||||
|
},
|
||||||
|
"eos_token": {
|
||||||
|
"content": "<|endoftext|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false
|
||||||
|
},
|
||||||
|
"pad_token": {
|
||||||
|
"content": "<|bos|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false
|
||||||
|
},
|
||||||
|
"unk_token": {
|
||||||
|
"content": "<unk>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false
|
||||||
|
}
|
||||||
|
}
|
||||||
91172
tokenizer.json
Normal file
91172
tokenizer.json
Normal file
File diff suppressed because it is too large
Load Diff
89
tokenizer_config.json
Normal file
89
tokenizer_config.json
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
{
|
||||||
|
"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
|
||||||
|
},
|
||||||
|
"32000": {
|
||||||
|
"content": "<|bos|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"32001": {
|
||||||
|
"content": "<|endoftext|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"32002": {
|
||||||
|
"content": "[PAD]",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"32003": {
|
||||||
|
"content": "<|ASSISTANT|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"32004": {
|
||||||
|
"content": "<|USER|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additional_special_tokens": [],
|
||||||
|
"bos_token": "<|bos|>",
|
||||||
|
"clean_up_tokenization_spaces": false,
|
||||||
|
"eos_token": "<|endoftext|>",
|
||||||
|
"legacy": true,
|
||||||
|
"max_length": 1536,
|
||||||
|
"model_max_length": 1000000000000000019884624838656,
|
||||||
|
"pad_to_multiple_of": null,
|
||||||
|
"pad_token": "<|bos|>",
|
||||||
|
"pad_token_type_id": 0,
|
||||||
|
"padding_side": "right",
|
||||||
|
"sp_model_kwargs": {},
|
||||||
|
"spaces_between_special_tokens": false,
|
||||||
|
"stride": 0,
|
||||||
|
"tokenizer_class": "LlamaTokenizer",
|
||||||
|
"truncation_side": "right",
|
||||||
|
"truncation_strategy": "longest_first",
|
||||||
|
"unk_token": "<unk>",
|
||||||
|
"use_default_system_prompt": true
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user