seungahdev commited on
Commit
3f69ca9
1 Parent(s): bbf3040

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +162 -0
README.md ADDED
@@ -0,0 +1,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model: mistralai/Mixtral-8x22B-v0.1
4
+ inference: false
5
+ model_link: https://huggingface.co/mistralai/Mixtral-8x22B-v0.1
6
+ model_name: mistralai/Mixtral-8x22B-v0.1
7
+ pipeline_tag: text-generation
8
+ quantized_by: FriendliAI
9
+ tags:
10
+ - pretrained
11
+ ---
12
+
13
+ <!-- header start -->
14
+ <p align="center">
15
+ <img src="https://i.imgur.com/mNM6Cai.png" width="100%" alt="Friendli Logo">
16
+ </p>
17
+ <!-- header end -->
18
+
19
+ # Mixtral-8x22B-v0.1 - FP8
20
+
21
+ - Model creator: [Mistral AI](https://huggingface.co/mistralai)
22
+ - Original model: [Mixtral-8x22B-v0.1](https://huggingface.co/mistralai/Mixtral-8x22B-v0.1)
23
+
24
+ ## Description
25
+
26
+ This repo contains the Mixtral-8x22B-v0.1 model quantized to FP8 by FriendliAI, significantly enhancing its inference efficiency while maintaining high accuracy.
27
+ Note that FP8 is only supported by NVIDIA Ada, Hopper, and Blackwell GPU architectures.
28
+ Check out [FriendliAI documentation](https://docs.friendli.ai/) for more details.
29
+
30
+ ## Compatibility
31
+
32
+ This model is compatible with **[Friendli Container](https://friendli.ai/products/container/)**.
33
+
34
+ ## Prerequisites
35
+
36
+ - Before you begin, make sure you have signed up for [Friendli Suite](https://suite.friendli.ai/). **You can use Friendli Containers free of charge for four weeks.**
37
+ - Prepare a Personal Access Token following [this guide](#preparing-personal-access-token).
38
+ - Prepare a Friendli Container Secret following [this guide](#preparing-container-secret).
39
+
40
+ ### Preparing Personal Access Token
41
+
42
+ PAT (Personal Access Token) is the user credential for for logging into our container registry.
43
+
44
+ 1. Sign in [Friendli Suite](https://suite.friendli.ai/).
45
+ 2. Go to **[User Settings > Tokens](https://suite.friendli.ai/user-settings/tokens)** and click **'Create new token'**.
46
+ 3. Save your created token value.
47
+
48
+ ### Pulling Friendli Container Image
49
+
50
+ 1. Log in to the Docker client using the personal access token created as outlined in [this guide](#preparing-personal-access-token).
51
+
52
+ ```sh
53
+ export FRIENDLI_PAT="YOUR PAT"
54
+ docker login registry.friendli.ai -u $YOUR_EMAIL -p $FRIENDLI_PAT
55
+ ```
56
+
57
+ 2. Pull image
58
+
59
+ ```sh
60
+ docker pull registry.friendli.ai/trial
61
+ ```
62
+
63
+ ## Running Friendli Container
64
+
65
+ Once you've prepared the image of Friendli Container, you can launch it to create a serving endpoint.
66
+
67
+ ```sh
68
+ docker run \
69
+ --gpus '"device=0,1,2,3"' \
70
+ -p 8000:8000 \
71
+ -v ~/.cache/huggingface:/root/.cache/huggingface \
72
+ -e FRIENDLI_CONTAINER_SECRET="YOUR CONTAINER SECRET" \
73
+ registry.friendli.ai/trial \
74
+ --web-server-port 8000 \
75
+ --hf-model-name FriendliAI/Mixtral-8x22B-v0.1-fp8
76
+ ```
77
+
78
+ ### Optimizing Inference Performance with Policy Search
79
+
80
+ To serve MoE models efficiently, it is required to run a policy search to explore the optimal execution policy:
81
+
82
+ ```sh
83
+ export POLICY_DIR=$PWD/policy
84
+
85
+ mkdir -p $POLICY_DIR
86
+
87
+ docker run \
88
+ --gpus '"device=0,1,2,3"' \
89
+ -p 8000:8000 \
90
+ -v ~/.cache/huggingface:/root/.cache/huggingface \
91
+ -v $POLICY_DIR:/policy \
92
+ -e FRIENDLI_CONTAINER_SECRET="YOUR CONTAINER SECRET" \
93
+ registry.friendli.ai/trial \
94
+ --web-server-port 8000 \
95
+ --hf-model-name FriendliAI/Mixtral-8x22B-v0.1-fp8 \
96
+ --algo-policy-dir /policy \
97
+ --search-policy true
98
+ ```
99
+
100
+ When the optimal policy is successfully searched, the policy is compiled into a policy file and saved at `$POLICY_DIR`.
101
+ Now you can create an inference endpoint with this optimal policy as follows:
102
+
103
+ ```sh
104
+ docker run \
105
+ --gpus '"device=0,1,2,3"' \
106
+ -p 8000:8000 \
107
+ -v ~/.cache/huggingface:/root/.cache/huggingface \
108
+ -v $POLICY_DIR:/policy \
109
+ -e FRIENDLI_CONTAINER_SECRET="YOUR CONTAINER SECRET" \
110
+ registry.friendli.ai/trial \
111
+ --web-server-port 8000 \
112
+ --hf-model-name FriendliAI/Mixtral-8x22B-v0.1-fp8 \
113
+ --algo-policy-dir /policy
114
+ ```
115
+
116
+ ---
117
+
118
+ # Original model card: MistralAI's Mixtral-8x22B v0.1
119
+
120
+ # Model Card for Mixtral-8x22B
121
+ The Mixtral-8x22B Large Language Model (LLM) is a pretrained generative Sparse Mixture of Experts.
122
+
123
+ For full details of this model please read our [release blog post](https://mistral.ai/news/mixtral-8x22b).
124
+
125
+ ## Warning
126
+ This repo contains weights that are compatible with [vLLM](https://github.com/vllm-project/vllm) serving of the model as well as Hugging Face [transformers](https://github.com/huggingface/transformers) library. It is based on the original Mixtral [torrent release](https://twitter.com/MistralAI/status/1777869263778291896), but the file format and parameter names are different.
127
+
128
+ ## Run the model
129
+
130
+
131
+ ```python
132
+ from transformers import AutoModelForCausalLM, AutoTokenizer
133
+
134
+ model_id = "mistralai/Mixtral-8x22B-v0.1"
135
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
136
+
137
+ model = AutoModelForCausalLM.from_pretrained(model_id)
138
+
139
+ text = "Hello my name is"
140
+ inputs = tokenizer(text, return_tensors="pt")
141
+
142
+ outputs = model.generate(**inputs, max_new_tokens=20)
143
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
144
+ ```
145
+
146
+ By default, transformers will load the model in full precision. Therefore you might be interested to further reduce down the memory requirements to run the model through the optimizations we offer in HF ecosystem:
147
+
148
+ ## Notice
149
+ Mixtral-8x22B is a pretrained base model and therefore does not have any moderation mechanisms.
150
+
151
+ # The Mistral AI Team
152
+ Albert Jiang, Alexandre Sablayrolles, Alexis Tacnet, Antoine Roux,
153
+ Arthur Mensch, Audrey Herblin-Stoop, Baptiste Bout, Baudouin de Monicault,
154
+ Blanche Savary, Bam4d, Caroline Feldman, Devendra Singh Chaplot,
155
+ Diego de las Casas, Eleonore Arcelin, Emma Bou Hanna, Etienne Metzger,
156
+ Gianna Lengyel, Guillaume Bour, Guillaume Lample, Harizo Rajaona,
157
+ Jean-Malo Delignon, Jia Li, Justus Murke, Louis Martin, Louis Ternon,
158
+ Lucile Saulnier, Lélio Renard Lavaud, Margaret Jennings, Marie Pellat,
159
+ Marie Torelli, Marie-Anne Lachaux, Nicolas Schuhl, Patrick von Platen,
160
+ Pierre Stock, Sandeep Subramanian, Sophia Yang, Szymon Antoniak, Teven Le Scao,
161
+ Thibaut Lavril, Timothée Lacroix, Théophile Gervet, Thomas Wang,
162
+ Valera Nemychnikova, William El Sayed, William Marshall