shaheerzk commited on
Commit
52e05e7
·
verified ·
1 Parent(s): 48e7d0b

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +8 -82
README.md CHANGED
@@ -13,45 +13,15 @@ extra_gated_description: >-
13
  our <a href="https://mistral.ai/terms/">Privacy Policy</a>.
14
  ---
15
 
16
- # Model Card for Mistral-7B-Instruct-v0.2
17
 
18
 
19
- ## Encode and Decode with `mistral_common`
20
-
21
- ```py
22
- from mistral_common.tokens.tokenizers.mistral import MistralTokenizer
23
- from mistral_common.protocol.instruct.messages import UserMessage
24
- from mistral_common.protocol.instruct.request import ChatCompletionRequest
25
-
26
- mistral_models_path = "MISTRAL_MODELS_PATH"
27
-
28
- tokenizer = MistralTokenizer.v1()
29
-
30
- completion_request = ChatCompletionRequest(messages=[UserMessage(content="Explain Machine Learning to me in a nutshell.")])
31
-
32
- tokens = tokenizer.encode_chat_completion(completion_request).tokens
33
- ```
34
-
35
- ## Inference with `mistral_inference`
36
-
37
- ```py
38
- from mistral_inference.transformer import Transformer
39
- from mistral_inference.generate import generate
40
-
41
- model = Transformer.from_folder(mistral_models_path)
42
- out_tokens, _ = generate([tokens], model, max_tokens=64, temperature=0.0, eos_id=tokenizer.instruct_tokenizer.tokenizer.eos_id)
43
-
44
- result = tokenizer.decode(out_tokens[0])
45
-
46
- print(result)
47
- ```
48
-
49
  ## Inference with hugging face `transformers`
50
 
51
  ```py
52
  from transformers import AutoModelForCausalLM
53
 
54
- model = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-Instruct-v0.2")
55
  model.to("cuda")
56
 
57
  generated_ids = model.generate(tokens, max_new_tokens=1000, do_sample=True)
@@ -66,26 +36,11 @@ print(result)
66
 
67
  ---
68
 
69
- The Mistral-7B-Instruct-v0.2 Large Language Model (LLM) is an instruct fine-tuned version of the Mistral-7B-v0.2.
70
 
71
- Mistral-7B-v0.2 has the following changes compared to Mistral-7B-v0.1
72
- - 32k context window (vs 8k context in v0.1)
73
- - Rope-theta = 1e6
74
- - No Sliding-Window Attention
75
-
76
- For full details of this model please read our [paper](https://arxiv.org/abs/2310.06825) and [release blog post](https://mistral.ai/news/la-plateforme/).
77
 
78
  ## Instruction format
79
 
80
- In order to leverage instruction fine-tuning, your prompt should be surrounded by `[INST]` and `[/INST]` tokens. The very first instruction should begin with a begin of sentence id. The next instructions should not. The assistant generation will be ended by the end-of-sentence token id.
81
-
82
- E.g.
83
- ```
84
- text = "<s>[INST] What is your favourite condiment? [/INST]"
85
- "Well, I'm quite partial to a good squeeze of fresh lemon juice. It adds just the right amount of zesty flavour to whatever I'm cooking up in the kitchen!</s> "
86
- "[INST] Do you have mayonnaise recipes? [/INST]"
87
- ```
88
-
89
  This format is available as a [chat template](https://huggingface.co/docs/transformers/main/chat_templating) via the `apply_chat_template()` method:
90
 
91
  ```python
@@ -93,13 +48,13 @@ from transformers import AutoModelForCausalLM, AutoTokenizer
93
 
94
  device = "cuda" # the device to load the model onto
95
 
96
- model = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-Instruct-v0.2")
97
- tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-Instruct-v0.2")
98
 
99
  messages = [
100
- {"role": "user", "content": "What is your favourite condiment?"},
101
- {"role": "assistant", "content": "Well, I'm quite partial to a good squeeze of fresh lemon juice. It adds just the right amount of zesty flavour to whatever I'm cooking up in the kitchen!"},
102
- {"role": "user", "content": "Do you have mayonnaise recipes?"}
103
  ]
104
 
105
  encodeds = tokenizer.apply_chat_template(messages, return_tensors="pt")
@@ -111,32 +66,3 @@ generated_ids = model.generate(model_inputs, max_new_tokens=1000, do_sample=True
111
  decoded = tokenizer.batch_decode(generated_ids)
112
  print(decoded[0])
113
  ```
114
-
115
- ## Troubleshooting
116
- - If you see the following error:
117
- ```
118
- Traceback (most recent call last):
119
- File "", line 1, in
120
- File "/transformers/models/auto/auto_factory.py", line 482, in from_pretrained
121
- config, kwargs = AutoConfig.from_pretrained(
122
- File "/transformers/models/auto/configuration_auto.py", line 1022, in from_pretrained
123
- config_class = CONFIG_MAPPING[config_dict["model_type"]]
124
- File "/transformers/models/auto/configuration_auto.py", line 723, in getitem
125
- raise KeyError(key)
126
- KeyError: 'mistral'
127
- ```
128
-
129
- Installing transformers from source should solve the issue
130
- pip install git+https://github.com/huggingface/transformers
131
-
132
- This should not be required after transformers-v4.33.4.
133
-
134
- ## Limitations
135
-
136
- The Mistral 7B Instruct model is a quick demonstration that the base model can be easily fine-tuned to achieve compelling performance.
137
- It does not have any moderation mechanisms. We're looking forward to engaging with the community on ways to
138
- make the model finely respect guardrails, allowing for deployment in environments requiring moderated outputs.
139
-
140
- ## The Mistral AI Team
141
-
142
- Albert Jiang, Alexandre Sablayrolles, Arthur Mensch, Blanche Savary, Chris Bamford, Devendra Singh Chaplot, Diego de las Casas, Emma Bou Hanna, Florian Bressand, Gianna Lengyel, Guillaume Bour, Guillaume Lample, Lélio Renard Lavaud, Louis Ternon, Lucile Saulnier, Marie-Anne Lachaux, Pierre Stock, Teven Le Scao, Théophile Gervet, Thibaut Lavril, Thomas Wang, Timothée Lacroix, William El Sayed.
 
13
  our <a href="https://mistral.ai/terms/">Privacy Policy</a>.
14
  ---
15
 
16
+ # Model Card for shaheerzk/text-to-rdb-queries
17
 
18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  ## Inference with hugging face `transformers`
20
 
21
  ```py
22
  from transformers import AutoModelForCausalLM
23
 
24
+ model = AutoModelForCausalLM.from_pretrained("shaheerzk/text-to-rdb-queries")
25
  model.to("cuda")
26
 
27
  generated_ids = model.generate(tokens, max_new_tokens=1000, do_sample=True)
 
36
 
37
  ---
38
 
39
+ The shaheerzk/text-to-rdb-queries Large Language Model (LLM) is an instruct fine-tuned version of the Mistral-7B-v0.2.
40
 
 
 
 
 
 
 
41
 
42
  ## Instruction format
43
 
 
 
 
 
 
 
 
 
 
44
  This format is available as a [chat template](https://huggingface.co/docs/transformers/main/chat_templating) via the `apply_chat_template()` method:
45
 
46
  ```python
 
48
 
49
  device = "cuda" # the device to load the model onto
50
 
51
+ model = AutoModelForCausalLM.from_pretrained("shaheerzk/text-to-rdb-queries")
52
+ tokenizer = AutoTokenizer.from_pretrained("shaheerzk/text-to-rdb-queries")
53
 
54
  messages = [
55
+ {"role": "user", "content": ""},
56
+ {"role": "assistant", "content": ""},
57
+ {"role": "user", "content": ""}
58
  ]
59
 
60
  encodeds = tokenizer.apply_chat_template(messages, return_tensors="pt")
 
66
  decoded = tokenizer.batch_decode(generated_ids)
67
  print(decoded[0])
68
  ```