v2ray commited on
Commit
62d3ed0
1 Parent(s): 86a4a14

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +104 -0
README.md ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - fr
5
+ - it
6
+ - de
7
+ - es
8
+ - en
9
+ tags:
10
+ - moe
11
+ ---
12
+ # Model Card for Mixtral-8x22B
13
+ Converted to HuggingFace Transformers format using the script [here]().
14
+
15
+ The Mixtral-8x22B Large Language Model (LLM) is a pretrained generative Sparse Mixture of Experts.
16
+ ## Run the model
17
+ ```python
18
+ from transformers import AutoModelForCausalLM, AutoTokenizer
19
+
20
+ model_id = "v2ray/Mixtral-8x22B-v0.1"
21
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
22
+
23
+ model = AutoModelForCausalLM.from_pretrained(model_id)
24
+
25
+ text = "Hello my name is"
26
+ inputs = tokenizer(text, return_tensors="pt")
27
+
28
+ outputs = model.generate(**inputs, max_new_tokens=20)
29
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
30
+ ```
31
+
32
+ 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:
33
+
34
+ ### In half-precision
35
+
36
+ Note `float16` precision only works on GPU devices
37
+
38
+ <details>
39
+ <summary> Click to expand </summary>
40
+
41
+ ```diff
42
+ + import torch
43
+ from transformers import AutoModelForCausalLM, AutoTokenizer
44
+
45
+ model_id = "v2ray/Mixtral-8x22B-v0.1"
46
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
47
+
48
+ + model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.float16).to(0)
49
+
50
+ text = "Hello my name is"
51
+ + inputs = tokenizer(text, return_tensors="pt").to(0)
52
+
53
+ outputs = model.generate(**inputs, max_new_tokens=20)
54
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
55
+ ```
56
+ </details>
57
+
58
+ ### Lower precision using (8-bit & 4-bit) using `bitsandbytes`
59
+
60
+ <details>
61
+ <summary> Click to expand </summary>
62
+
63
+ ```diff
64
+ + import torch
65
+ from transformers import AutoModelForCausalLM, AutoTokenizer
66
+
67
+ model_id = "v2ray/Mixtral-8x22B-v0.1"
68
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
69
+
70
+ + model = AutoModelForCausalLM.from_pretrained(model_id, load_in_4bit=True)
71
+
72
+ text = "Hello my name is"
73
+ + inputs = tokenizer(text, return_tensors="pt").to(0)
74
+
75
+ outputs = model.generate(**inputs, max_new_tokens=20)
76
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
77
+ ```
78
+ </details>
79
+
80
+ ### Load the model with Flash Attention 2
81
+
82
+ <details>
83
+ <summary> Click to expand </summary>
84
+
85
+ ```diff
86
+ + import torch
87
+ from transformers import AutoModelForCausalLM, AutoTokenizer
88
+
89
+ model_id = "v2ray/Mixtral-8x22B-v0.1"
90
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
91
+
92
+ + model = AutoModelForCausalLM.from_pretrained(model_id, use_flash_attention_2=True)
93
+
94
+ text = "Hello my name is"
95
+ + inputs = tokenizer(text, return_tensors="pt").to(0)
96
+
97
+ outputs = model.generate(**inputs, max_new_tokens=20)
98
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
99
+ ```
100
+ </details>
101
+ ## Notice
102
+ Mixtral-8x22B-v0.1 is a pretrained base model and therefore does not have any moderation mechanisms.
103
+ # The Mistral AI Team
104
+ Albert Jiang, Alexandre Sablayrolles, Alexis Tacnet, Antoine Roux, Arthur Mensch, Audrey Herblin-Stoop, Baptiste Bout, Baudouin de Monicault,Blanche Savary, Bam4d, Caroline Feldman, Devendra Singh Chaplot, Diego de las Casas, Eleonore Arcelin, Emma Bou Hanna, Etienne Metzger, Gianna Lengyel, Guillaume Bour, Guillaume Lample, Harizo Rajaona, Jean-Malo Delignon, Jia Li, Justus Murke, Louis Martin, Louis Ternon, Lucile Saulnier, Lélio Renard Lavaud, Margaret Jennings, Marie Pellat, Marie Torelli, Marie-Anne Lachaux, Nicolas Schuhl, Patrick von Platen, Pierre Stock, Sandeep Subramanian, Sophia Yang, Szymon Antoniak, Teven Le Scao, Thibaut Lavril, Timothée Lacroix, Théophile Gervet, Thomas Wang, Valera Nemychnikova, William El Sayed, William Marshall.