Text Generation
Transformers
Safetensors
mixtral
Mixture of Experts
conversational
text-generation-inference
Instructions to use gagan3012/Multirial with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use gagan3012/Multirial with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="gagan3012/Multirial") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("gagan3012/Multirial") model = AutoModelForCausalLM.from_pretrained("gagan3012/Multirial") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use gagan3012/Multirial with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "gagan3012/Multirial" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "gagan3012/Multirial", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/gagan3012/Multirial
- SGLang
How to use gagan3012/Multirial with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "gagan3012/Multirial" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "gagan3012/Multirial", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "gagan3012/Multirial" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "gagan3012/Multirial", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use gagan3012/Multirial with Docker Model Runner:
docker model run hf.co/gagan3012/Multirial
Upload folder using huggingface_hub
Browse files- README.md +103 -0
- config.json +30 -0
README.md
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
tags:
|
| 4 |
+
- moe
|
| 5 |
+
- mixtral
|
| 6 |
+
- fblgit/UNA-TheBeagle-7b-v1
|
| 7 |
+
- openchat/openchat-3.5-0106
|
| 8 |
+
- azale-ai/Starstreak-7b-beta
|
| 9 |
+
- gagan3012/Mistral_arabic_dpo
|
| 10 |
+
- davidkim205/komt-mistral-7b-v1
|
| 11 |
+
- OpenBuddy/openbuddy-zephyr-7b-v14.1
|
| 12 |
+
- manishiitg/open-aditi-hi-v1
|
| 13 |
+
- VAGOsolutions/SauerkrautLM-7b-v1-mistral
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# Multirial
|
| 17 |
+
|
| 18 |
+
This model is a Mixure of Experts (MoE) made with [mergekit](https://github.com/cg123/mergekit) (mixtral branch). It uses the following base models:
|
| 19 |
+
* [fblgit/UNA-TheBeagle-7b-v1](https://huggingface.co/fblgit/UNA-TheBeagle-7b-v1)
|
| 20 |
+
* [openchat/openchat-3.5-0106](https://huggingface.co/openchat/openchat-3.5-0106)
|
| 21 |
+
* [azale-ai/Starstreak-7b-beta](https://huggingface.co/azale-ai/Starstreak-7b-beta)
|
| 22 |
+
* [gagan3012/Mistral_arabic_dpo](https://huggingface.co/gagan3012/Mistral_arabic_dpo)
|
| 23 |
+
* [davidkim205/komt-mistral-7b-v1](https://huggingface.co/davidkim205/komt-mistral-7b-v1)
|
| 24 |
+
* [OpenBuddy/openbuddy-zephyr-7b-v14.1](https://huggingface.co/OpenBuddy/openbuddy-zephyr-7b-v14.1)
|
| 25 |
+
* [manishiitg/open-aditi-hi-v1](https://huggingface.co/manishiitg/open-aditi-hi-v1)
|
| 26 |
+
* [VAGOsolutions/SauerkrautLM-7b-v1-mistral](https://huggingface.co/VAGOsolutions/SauerkrautLM-7b-v1-mistral)
|
| 27 |
+
|
| 28 |
+
## 🧩 Configuration
|
| 29 |
+
|
| 30 |
+
```yamlbase_model: gagan3012/Mistral_arabic_dpo
|
| 31 |
+
dtype: bfloat16
|
| 32 |
+
experts:
|
| 33 |
+
- positive_prompts:
|
| 34 |
+
- chat
|
| 35 |
+
- assistant
|
| 36 |
+
- tell me
|
| 37 |
+
- explain
|
| 38 |
+
source_model: fblgit/UNA-TheBeagle-7b-v1
|
| 39 |
+
- positive_prompts:
|
| 40 |
+
- chat
|
| 41 |
+
- assistant
|
| 42 |
+
- tell me
|
| 43 |
+
- explain
|
| 44 |
+
source_model: openchat/openchat-3.5-0106
|
| 45 |
+
- positive_prompts:
|
| 46 |
+
- indonesian
|
| 47 |
+
- indonesia
|
| 48 |
+
- answer in indonesian
|
| 49 |
+
source_model: azale-ai/Starstreak-7b-beta
|
| 50 |
+
- positive_prompts:
|
| 51 |
+
- arabic
|
| 52 |
+
- arab
|
| 53 |
+
- arabia
|
| 54 |
+
- answer in arabic
|
| 55 |
+
source_model: gagan3012/Mistral_arabic_dpo
|
| 56 |
+
- positive_prompts:
|
| 57 |
+
- korean
|
| 58 |
+
- answer in korean
|
| 59 |
+
- korea
|
| 60 |
+
source_model: davidkim205/komt-mistral-7b-v1
|
| 61 |
+
- positive_prompts:
|
| 62 |
+
- chinese
|
| 63 |
+
- china
|
| 64 |
+
- answer in chinese
|
| 65 |
+
source_model: OpenBuddy/openbuddy-zephyr-7b-v14.1
|
| 66 |
+
- positive_prompts:
|
| 67 |
+
- hindi
|
| 68 |
+
- india
|
| 69 |
+
- hindu
|
| 70 |
+
- answer in hindi
|
| 71 |
+
source_model: manishiitg/open-aditi-hi-v1
|
| 72 |
+
- positive_prompts:
|
| 73 |
+
- german
|
| 74 |
+
- germany
|
| 75 |
+
- answer in german
|
| 76 |
+
- deutsch
|
| 77 |
+
source_model: VAGOsolutions/SauerkrautLM-7b-v1-mistral
|
| 78 |
+
gate_mode: hidden
|
| 79 |
+
```
|
| 80 |
+
|
| 81 |
+
## 💻 Usage
|
| 82 |
+
|
| 83 |
+
```python
|
| 84 |
+
!pip install -qU transformers bitsandbytes accelerate
|
| 85 |
+
|
| 86 |
+
from transformers import AutoTokenizer
|
| 87 |
+
import transformers
|
| 88 |
+
import torch
|
| 89 |
+
|
| 90 |
+
model = "gagan3012/Multirial"
|
| 91 |
+
|
| 92 |
+
tokenizer = AutoTokenizer.from_pretrained(model)
|
| 93 |
+
pipeline = transformers.pipeline(
|
| 94 |
+
"text-generation",
|
| 95 |
+
model=model,
|
| 96 |
+
model_kwargs={"torch_dtype": torch.float16, "load_in_4bit": True},
|
| 97 |
+
)
|
| 98 |
+
|
| 99 |
+
messages = [{"role": "user", "content": "Explain what a Mixture of Experts is in less than 100 words."}]
|
| 100 |
+
prompt = pipeline.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
| 101 |
+
outputs = pipeline(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
|
| 102 |
+
print(outputs[0]["generated_text"])
|
| 103 |
+
```
|
config.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_name_or_path": "gagan3012/Mistral_arabic_dpo",
|
| 3 |
+
"architectures": [
|
| 4 |
+
"MixtralForCausalLM"
|
| 5 |
+
],
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"bos_token_id": 1,
|
| 8 |
+
"eos_token_id": 2,
|
| 9 |
+
"hidden_act": "silu",
|
| 10 |
+
"hidden_size": 4096,
|
| 11 |
+
"initializer_range": 0.02,
|
| 12 |
+
"intermediate_size": 14336,
|
| 13 |
+
"max_position_embeddings": 32768,
|
| 14 |
+
"model_type": "mixtral",
|
| 15 |
+
"num_attention_heads": 32,
|
| 16 |
+
"num_experts_per_tok": 2,
|
| 17 |
+
"num_hidden_layers": 32,
|
| 18 |
+
"num_key_value_heads": 8,
|
| 19 |
+
"num_local_experts": 8,
|
| 20 |
+
"output_router_logits": false,
|
| 21 |
+
"rms_norm_eps": 1e-05,
|
| 22 |
+
"rope_theta": 1000000.0,
|
| 23 |
+
"router_aux_loss_coef": 0.001,
|
| 24 |
+
"sliding_window": null,
|
| 25 |
+
"tie_word_embeddings": false,
|
| 26 |
+
"torch_dtype": "float16",
|
| 27 |
+
"transformers_version": "4.36.2",
|
| 28 |
+
"use_cache": true,
|
| 29 |
+
"vocab_size": 32000
|
| 30 |
+
}
|