Upload model
Browse files- README.md +174 -195
- adapter_config.json +2 -2
- adapter_model.safetensors +1 -1
README.md
CHANGED
|
@@ -1,228 +1,207 @@
|
|
| 1 |
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
library_name: peft
|
| 4 |
-
tags:
|
| 5 |
-
- mistral
|
| 6 |
-
datasets:
|
| 7 |
-
- jondurbin/airoboros-2.2.1
|
| 8 |
-
inference: false
|
| 9 |
-
pipeline_tag: text-generation
|
| 10 |
base_model: mistralai/Mistral-7B-v0.1
|
| 11 |
---
|
| 12 |
|
| 13 |
-
|
| 14 |
|
| 15 |
-
|
| 16 |
|
| 17 |
-
</div>
|
| 18 |
|
| 19 |
-
# Mistral-7B-Instruct-v0.1
|
| 20 |
-
|
| 21 |
-
The Mistral-7B-Instruct-v0.1 LLM is a pretrained generative text model with 7 billion parameters geared towards instruction-following capabilities.
|
| 22 |
|
| 23 |
## Model Details
|
| 24 |
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
- **
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
- **
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
|
| 67 |
-
|
| 68 |
-
peft_model_id = "dfurman/Mistral-7B-Instruct-v0.1"
|
| 69 |
-
config = PeftConfig.from_pretrained(peft_model_id)
|
| 70 |
|
| 71 |
-
|
| 72 |
-
peft_model_id,
|
| 73 |
-
use_fast=True,
|
| 74 |
-
trust_remote_code=True,
|
| 75 |
-
)
|
| 76 |
-
bnb_config = BitsAndBytesConfig(
|
| 77 |
-
load_in_4bit=True,
|
| 78 |
-
bnb_4bit_quant_type="nf4",
|
| 79 |
-
bnb_4bit_compute_dtype=torch.bfloat16,
|
| 80 |
-
)
|
| 81 |
-
model = AutoModelForCausalLM.from_pretrained(
|
| 82 |
-
config.base_model_name_or_path,
|
| 83 |
-
quantization_config=bnb_config,
|
| 84 |
-
device_map="auto",
|
| 85 |
-
trust_remote_code=True,
|
| 86 |
-
)
|
| 87 |
-
model = PeftModel.from_pretrained(
|
| 88 |
-
model,
|
| 89 |
-
peft_model_id
|
| 90 |
-
)
|
| 91 |
-
```
|
| 92 |
|
| 93 |
-
|
| 94 |
|
|
|
|
| 95 |
|
| 96 |
-
|
| 97 |
-
messages = [
|
| 98 |
-
{"role": "user", "content": "Tell me a recipe for a mai tai."},
|
| 99 |
-
]
|
| 100 |
|
| 101 |
-
|
| 102 |
-
prompt = tokenizer.apply_chat_template(
|
| 103 |
-
messages,
|
| 104 |
-
tokenize=False,
|
| 105 |
-
add_generation_prompt=True
|
| 106 |
-
)
|
| 107 |
-
print(prompt)
|
| 108 |
|
| 109 |
-
|
| 110 |
-
input_ids = tokenizer(prompt, return_tensors="pt").input_ids.cuda()
|
| 111 |
-
with torch.autocast("cuda", dtype=torch.bfloat16):
|
| 112 |
-
output = model.generate(
|
| 113 |
-
input_ids=input_ids,
|
| 114 |
-
max_new_tokens=1024,
|
| 115 |
-
do_sample=True,
|
| 116 |
-
temperature=0.7,
|
| 117 |
-
return_dict_in_generate=True,
|
| 118 |
-
eos_token_id=tokenizer.eos_token_id,
|
| 119 |
-
pad_token_id=tokenizer.pad_token_id,
|
| 120 |
-
repetition_penalty=1.2,
|
| 121 |
-
no_repeat_ngram_size=5,
|
| 122 |
-
)
|
| 123 |
-
|
| 124 |
-
response = tokenizer.decode(
|
| 125 |
-
output["sequences"][0][len(input_ids[0]):],
|
| 126 |
-
skip_special_tokens=True
|
| 127 |
-
)
|
| 128 |
-
print(response)
|
| 129 |
-
```
|
| 130 |
-
|
| 131 |
-
<details>
|
| 132 |
-
|
| 133 |
-
<summary>Output</summary>
|
| 134 |
-
|
| 135 |
-
**Prompt**:
|
| 136 |
-
```python
|
| 137 |
-
coming
|
| 138 |
-
```
|
| 139 |
-
|
| 140 |
-
**Generation**:
|
| 141 |
-
```python
|
| 142 |
-
coming
|
| 143 |
-
```
|
| 144 |
-
|
| 145 |
-
</details>
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
## Speeds, Sizes, Times
|
| 149 |
-
|
| 150 |
-
| runtime / 50 tokens (sec) | GPU | attn | torch dtype | VRAM (GB) |
|
| 151 |
-
|:-----------------------------:|:----------------------:|:---------------------:|:-------------:|:-----------------------:|
|
| 152 |
-
| 3.1 | 1x A100 (40 GB SXM) | torch | fp16 | 13 |
|
| 153 |
-
|
| 154 |
-
## Training
|
| 155 |
-
|
| 156 |
-
It took ~3 hours to train 3 epochs on 1x A100 (40 GB SXM).
|
| 157 |
-
|
| 158 |
-
### Prompt Format
|
| 159 |
-
|
| 160 |
-
This model was finetuned with the following format:
|
| 161 |
-
|
| 162 |
-
```python
|
| 163 |
-
tokenizer.chat_template = "{{ bos_token }}{% for message in messages %}{% if (message['role'] == 'user') != (loop.index0 % 2 == 0) %}{{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }}{% endif %}{% if message['role'] == 'user' %}{{ '[INST] ' + message['content'] + ' [/INST] ' }}{% elif message['role'] == 'assistant' %}{{ message['content'] + eos_token + ' ' }}{% else %}{{ raise_exception('Only user and assistant roles are supported!') }}{% endif %}{% endfor %}"
|
| 164 |
-
```
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
This format is available as a [chat template](https://huggingface.co/docs/transformers/main/chat_templating) via the `apply_chat_template()` method. Here's an illustrative example:
|
| 168 |
-
|
| 169 |
-
```python
|
| 170 |
-
messages = [
|
| 171 |
-
{"role": "user", "content": "What is your favourite condiment?"},
|
| 172 |
-
{"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!"},
|
| 173 |
-
{"role": "user", "content": "Do you have mayonnaise recipes?"}
|
| 174 |
-
]
|
| 175 |
-
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
| 176 |
-
print(prompt)
|
| 177 |
-
```
|
| 178 |
-
|
| 179 |
-
<details>
|
| 180 |
-
|
| 181 |
-
<summary>Output</summary>
|
| 182 |
|
| 183 |
-
|
| 184 |
-
coming
|
| 185 |
-
```
|
| 186 |
-
</details>
|
| 187 |
|
| 188 |
-
|
| 189 |
|
|
|
|
| 190 |
|
| 191 |
-
|
| 192 |
|
| 193 |
-
|
| 194 |
|
| 195 |
-
|
| 196 |
-
- auto_find_batch_size = True
|
| 197 |
-
- gradient_accumulation_steps = 1
|
| 198 |
-
- optim = "paged_adamw_32bit"
|
| 199 |
-
- save_strategy = "epoch"
|
| 200 |
-
- learning_rate = 3e-4
|
| 201 |
-
- lr_scheduler_type = "cosine"
|
| 202 |
-
- warmup_ratio = 0.03
|
| 203 |
-
- logging_strategy = "steps"
|
| 204 |
-
- logging_steps = 25
|
| 205 |
-
- bf16 = True
|
| 206 |
|
| 207 |
-
|
| 208 |
|
| 209 |
-
|
| 210 |
-
- load_in_8bit: False
|
| 211 |
-
- load_in_4bit: True
|
| 212 |
-
- llm_int8_threshold: 6.0
|
| 213 |
-
- llm_int8_skip_modules: None
|
| 214 |
-
- llm_int8_enable_fp32_cpu_offload: False
|
| 215 |
-
- llm_int8_has_fp16_weight: False
|
| 216 |
-
- bnb_4bit_quant_type: nf4
|
| 217 |
-
- bnb_4bit_use_double_quant: False
|
| 218 |
-
- bnb_4bit_compute_dtype: bfloat16
|
| 219 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 220 |
|
| 221 |
## Model Card Contact
|
| 222 |
|
| 223 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 224 |
|
|
|
|
| 225 |
|
| 226 |
-
## Framework versions
|
| 227 |
|
| 228 |
-
- PEFT 0.6.
|
|
|
|
| 1 |
---
|
|
|
|
| 2 |
library_name: peft
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
base_model: mistralai/Mistral-7B-v0.1
|
| 4 |
---
|
| 5 |
|
| 6 |
+
# Model Card for Model ID
|
| 7 |
|
| 8 |
+
<!-- Provide a quick summary of what the model is/does. -->
|
| 9 |
|
|
|
|
| 10 |
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
## Model Details
|
| 13 |
|
| 14 |
+
### Model Description
|
| 15 |
+
|
| 16 |
+
<!-- Provide a longer summary of what this model is. -->
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
- **Developed by:** [More Information Needed]
|
| 21 |
+
- **Shared by [optional]:** [More Information Needed]
|
| 22 |
+
- **Model type:** [More Information Needed]
|
| 23 |
+
- **Language(s) (NLP):** [More Information Needed]
|
| 24 |
+
- **License:** [More Information Needed]
|
| 25 |
+
- **Finetuned from model [optional]:** [More Information Needed]
|
| 26 |
+
|
| 27 |
+
### Model Sources [optional]
|
| 28 |
+
|
| 29 |
+
<!-- Provide the basic links for the model. -->
|
| 30 |
+
|
| 31 |
+
- **Repository:** [More Information Needed]
|
| 32 |
+
- **Paper [optional]:** [More Information Needed]
|
| 33 |
+
- **Demo [optional]:** [More Information Needed]
|
| 34 |
+
|
| 35 |
+
## Uses
|
| 36 |
+
|
| 37 |
+
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
| 38 |
+
|
| 39 |
+
### Direct Use
|
| 40 |
+
|
| 41 |
+
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
| 42 |
+
|
| 43 |
+
[More Information Needed]
|
| 44 |
+
|
| 45 |
+
### Downstream Use [optional]
|
| 46 |
+
|
| 47 |
+
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
| 48 |
+
|
| 49 |
+
[More Information Needed]
|
| 50 |
+
|
| 51 |
+
### Out-of-Scope Use
|
| 52 |
+
|
| 53 |
+
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
| 54 |
+
|
| 55 |
+
[More Information Needed]
|
| 56 |
+
|
| 57 |
+
## Bias, Risks, and Limitations
|
| 58 |
+
|
| 59 |
+
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
| 60 |
+
|
| 61 |
+
[More Information Needed]
|
| 62 |
+
|
| 63 |
+
### Recommendations
|
| 64 |
+
|
| 65 |
+
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
| 66 |
+
|
| 67 |
+
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
| 68 |
+
|
| 69 |
+
## How to Get Started with the Model
|
| 70 |
+
|
| 71 |
+
Use the code below to get started with the model.
|
| 72 |
+
|
| 73 |
+
[More Information Needed]
|
| 74 |
+
|
| 75 |
+
## Training Details
|
| 76 |
+
|
| 77 |
+
### Training Data
|
| 78 |
+
|
| 79 |
+
<!-- This should link to a Data Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
|
| 80 |
+
|
| 81 |
+
[More Information Needed]
|
| 82 |
+
|
| 83 |
+
### Training Procedure
|
| 84 |
+
|
| 85 |
+
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
| 86 |
+
|
| 87 |
+
#### Preprocessing [optional]
|
| 88 |
+
|
| 89 |
+
[More Information Needed]
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
#### Training Hyperparameters
|
| 93 |
|
| 94 |
+
- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
|
|
|
|
|
|
|
| 95 |
|
| 96 |
+
#### Speeds, Sizes, Times [optional]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
|
| 98 |
+
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
| 99 |
|
| 100 |
+
[More Information Needed]
|
| 101 |
|
| 102 |
+
## Evaluation
|
|
|
|
|
|
|
|
|
|
| 103 |
|
| 104 |
+
<!-- This section describes the evaluation protocols and provides the results. -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
|
| 106 |
+
### Testing Data, Factors & Metrics
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
|
| 108 |
+
#### Testing Data
|
|
|
|
|
|
|
|
|
|
| 109 |
|
| 110 |
+
<!-- This should link to a Data Card if possible. -->
|
| 111 |
|
| 112 |
+
[More Information Needed]
|
| 113 |
|
| 114 |
+
#### Factors
|
| 115 |
|
| 116 |
+
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
| 117 |
|
| 118 |
+
[More Information Needed]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
|
| 120 |
+
#### Metrics
|
| 121 |
|
| 122 |
+
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
|
| 124 |
+
[More Information Needed]
|
| 125 |
+
|
| 126 |
+
### Results
|
| 127 |
+
|
| 128 |
+
[More Information Needed]
|
| 129 |
+
|
| 130 |
+
#### Summary
|
| 131 |
+
|
| 132 |
+
|
| 133 |
+
|
| 134 |
+
## Model Examination [optional]
|
| 135 |
+
|
| 136 |
+
<!-- Relevant interpretability work for the model goes here -->
|
| 137 |
+
|
| 138 |
+
[More Information Needed]
|
| 139 |
+
|
| 140 |
+
## Environmental Impact
|
| 141 |
+
|
| 142 |
+
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
| 143 |
+
|
| 144 |
+
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
| 145 |
+
|
| 146 |
+
- **Hardware Type:** [More Information Needed]
|
| 147 |
+
- **Hours used:** [More Information Needed]
|
| 148 |
+
- **Cloud Provider:** [More Information Needed]
|
| 149 |
+
- **Compute Region:** [More Information Needed]
|
| 150 |
+
- **Carbon Emitted:** [More Information Needed]
|
| 151 |
+
|
| 152 |
+
## Technical Specifications [optional]
|
| 153 |
+
|
| 154 |
+
### Model Architecture and Objective
|
| 155 |
+
|
| 156 |
+
[More Information Needed]
|
| 157 |
+
|
| 158 |
+
### Compute Infrastructure
|
| 159 |
+
|
| 160 |
+
[More Information Needed]
|
| 161 |
+
|
| 162 |
+
#### Hardware
|
| 163 |
+
|
| 164 |
+
[More Information Needed]
|
| 165 |
+
|
| 166 |
+
#### Software
|
| 167 |
+
|
| 168 |
+
[More Information Needed]
|
| 169 |
+
|
| 170 |
+
## Citation [optional]
|
| 171 |
+
|
| 172 |
+
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
| 173 |
+
|
| 174 |
+
**BibTeX:**
|
| 175 |
+
|
| 176 |
+
[More Information Needed]
|
| 177 |
+
|
| 178 |
+
**APA:**
|
| 179 |
+
|
| 180 |
+
[More Information Needed]
|
| 181 |
+
|
| 182 |
+
## Glossary [optional]
|
| 183 |
+
|
| 184 |
+
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
| 185 |
+
|
| 186 |
+
[More Information Needed]
|
| 187 |
+
|
| 188 |
+
## More Information [optional]
|
| 189 |
+
|
| 190 |
+
[More Information Needed]
|
| 191 |
+
|
| 192 |
+
## Model Card Authors [optional]
|
| 193 |
+
|
| 194 |
+
[More Information Needed]
|
| 195 |
|
| 196 |
## Model Card Contact
|
| 197 |
|
| 198 |
+
[More Information Needed]
|
| 199 |
+
|
| 200 |
+
|
| 201 |
+
## Training procedure
|
| 202 |
+
|
| 203 |
|
| 204 |
+
### Framework versions
|
| 205 |
|
|
|
|
| 206 |
|
| 207 |
+
- PEFT 0.6.3.dev0
|
adapter_config.json
CHANGED
|
@@ -18,8 +18,8 @@
|
|
| 18 |
"target_modules": [
|
| 19 |
"q_proj",
|
| 20 |
"k_proj",
|
| 21 |
-
"
|
| 22 |
-
"
|
| 23 |
],
|
| 24 |
"task_type": "CAUSAL_LM"
|
| 25 |
}
|
|
|
|
| 18 |
"target_modules": [
|
| 19 |
"q_proj",
|
| 20 |
"k_proj",
|
| 21 |
+
"o_proj",
|
| 22 |
+
"v_proj"
|
| 23 |
],
|
| 24 |
"task_type": "CAUSAL_LM"
|
| 25 |
}
|
adapter_model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 218138576
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1ded85167e6b54904ad7398d35c9655854ca30c5046c75417bb776d3973a02c1
|
| 3 |
size 218138576
|