patrickvonplaten commited on
Commit
5ffd152
·
verified ·
1 Parent(s): 4e03422

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +9 -81
README.md CHANGED
@@ -1,22 +1,21 @@
1
  ---
2
- base_model: mistralai/Mistral-7B-v0.3
3
  extra_gated_description: >-
4
  If you want to learn more about how we process your personal data, please read
5
  our <a href="https://mistral.ai/terms/">Privacy Policy</a>.
6
  ---
7
 
8
- # Model Card for Mistral-7B-Instruct-v0.3
9
 
10
- The Mistral-7B-Instruct-v0.3 Large Language Model (LLM) is an instruct fine-tuned version of the Mistral-7B-v0.3.
11
 
12
- Mistral-7B-v0.3 has the following changes compared to [Mistral-7B-v0.2](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.2/edit/main/README.md)
13
- - Extended vocabulary to 32768
14
- - Supports v3 Tokenizer
15
  - Supports function calling
 
16
 
17
  ## Installation
18
 
19
- It is recommended to use `mistralai/Mistral-7B-Instruct-v0.3` with [mistral-inference](https://github.com/mistralai/mistral-inference). For HF transformers code snippets, please keep scrolling.
20
 
21
  ```
22
  pip install mistral_inference
@@ -28,10 +27,10 @@ pip install mistral_inference
28
  from huggingface_hub import snapshot_download
29
  from pathlib import Path
30
 
31
- mistral_models_path = Path.home().joinpath('mistral_models', '7B-Instruct-v0.3')
32
  mistral_models_path.mkdir(parents=True, exist_ok=True)
33
 
34
- snapshot_download(repo_id="mistralai/Mistral-7B-Instruct-v0.3", allow_patterns=["params.json", "consolidated.safetensors", "tokenizer.model.v3"], local_dir=mistral_models_path)
35
  ```
36
 
37
  ### Chat
@@ -39,7 +38,7 @@ snapshot_download(repo_id="mistralai/Mistral-7B-Instruct-v0.3", allow_patterns=[
39
  After installing `mistral_inference`, a `mistral-chat` CLI command should be available in your environment. You can chat with the model using
40
 
41
  ```
42
- mistral-chat $HOME/mistral_models/7B-Instruct-v0.3 --instruct --max_tokens 256
43
  ```
44
 
45
  ### Instruct following
@@ -118,77 +117,6 @@ result = tokenizer.instruct_tokenizer.tokenizer.decode(out_tokens[0])
118
  print(result)
119
  ```
120
 
121
- ## Generate with `transformers`
122
-
123
- If you want to use Hugging Face `transformers` to generate text, you can do something like this.
124
-
125
- ```py
126
- from transformers import pipeline
127
-
128
- messages = [
129
- {"role": "system", "content": "You are a pirate chatbot who always responds in pirate speak!"},
130
- {"role": "user", "content": "Who are you?"},
131
- ]
132
- chatbot = pipeline("text-generation", model="mistralai/Mistral-7B-Instruct-v0.3")
133
- chatbot(messages)
134
- ```
135
-
136
-
137
- ## Function calling with `transformers`
138
-
139
- To use this example, you'll need `transformers` version 4.42.0 or higher. Please see the
140
- [function calling guide](https://huggingface.co/docs/transformers/main/chat_templating#advanced-tool-use--function-calling)
141
- in the `transformers` docs for more information.
142
-
143
- ```python
144
- from transformers import AutoModelForCausalLM, AutoTokenizer
145
- import torch
146
-
147
- model_id = "mistralai/Mistral-7B-Instruct-v0.3"
148
- tokenizer = AutoTokenizer.from_pretrained(model_id)
149
-
150
- def get_current_weather(location: str, format: str):
151
- """
152
- Get the current weather
153
-
154
- Args:
155
- location: The city and state, e.g. San Francisco, CA
156
- format: The temperature unit to use. Infer this from the users location. (choices: ["celsius", "fahrenheit"])
157
- """
158
- pass
159
-
160
- conversation = [{"role": "user", "content": "What's the weather like in Paris?"}]
161
- tools = [get_current_weather]
162
-
163
-
164
- # format and tokenize the tool use prompt
165
- inputs = tokenizer.apply_chat_template(
166
- conversation,
167
- tools=tools,
168
- add_generation_prompt=True,
169
- return_dict=True,
170
- return_tensors="pt",
171
- )
172
-
173
- model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="auto")
174
-
175
- inputs.to(model.device)
176
- outputs = model.generate(**inputs, max_new_tokens=1000)
177
- print(tokenizer.decode(outputs[0], skip_special_tokens=True))
178
- ```
179
-
180
- Note that, for reasons of space, this example does not show a complete cycle of calling a tool and adding the tool call and tool
181
- results to the chat history so that the model can use them in its next generation. For a full tool calling example, please
182
- see the [function calling guide](https://huggingface.co/docs/transformers/main/chat_templating#advanced-tool-use--function-calling),
183
- and note that Mistral **does** use tool call IDs, so these must be included in your tool calls and tool results. They should be
184
- exactly 9 alphanumeric characters.
185
-
186
-
187
- ## Limitations
188
-
189
- The Mistral 7B Instruct model is a quick demonstration that the base model can be easily fine-tuned to achieve compelling performance.
190
- It does not have any moderation mechanisms. We're looking forward to engaging with the community on ways to
191
- make the model finely respect guardrails, allowing for deployment in environments requiring moderated outputs.
192
 
193
  ## The Mistral AI Team
194
 
 
1
  ---
 
2
  extra_gated_description: >-
3
  If you want to learn more about how we process your personal data, please read
4
  our <a href="https://mistral.ai/terms/">Privacy Policy</a>.
5
  ---
6
 
7
+ # Model Card for Mistral-Small-Instruct-2409
8
 
9
+ Mistral-Small-Instruct-2409 is an instruct fine-tuned version with the following key characteristics:
10
 
11
+ - 22B parameters
12
+ - Vocabulary to 32768
 
13
  - Supports function calling
14
+ - 128k sequence length
15
 
16
  ## Installation
17
 
18
+ It is recommended to use `mistralai/Mistral-Small-Instruct-2409` with [mistral-inference](https://github.com/mistralai/mistral-inference). For HF transformers code snippets, please keep scrolling.
19
 
20
  ```
21
  pip install mistral_inference
 
27
  from huggingface_hub import snapshot_download
28
  from pathlib import Path
29
 
30
+ mistral_models_path = Path.home().joinpath('mistral_models', '22B-Instruct-Small')
31
  mistral_models_path.mkdir(parents=True, exist_ok=True)
32
 
33
+ snapshot_download(repo_id="mistralai/Mistral-Small-Instruct-2409", allow_patterns=["params.json", "consolidated.safetensors", "tokenizer.model.v3"], local_dir=mistral_models_path)
34
  ```
35
 
36
  ### Chat
 
38
  After installing `mistral_inference`, a `mistral-chat` CLI command should be available in your environment. You can chat with the model using
39
 
40
  ```
41
+ mistral-chat $HOME/mistral_models/22B-Instruct-Small --instruct --max_tokens 256
42
  ```
43
 
44
  ### Instruct following
 
117
  print(result)
118
  ```
119
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
 
121
  ## The Mistral AI Team
122