PEFT
English
File size: 2,250 Bytes
883bae5
 
9f196d3
 
 
 
 
 
883bae5
9f196d3
 
883bae5
 
9f196d3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
883bae5
9f196d3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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
69
70
71
72
73
---
library_name: peft
datasets:
- laion/OIG
- argilla/oig-30k
language:
- en
license: apache-2.0
---
# Model card for Mistral-7B-v0.1-chat-OIG
Mistral-7B-v0.1-chat-OIG is a LLM trained to act as a chat assistant, capable of subsequent prompting. It is finetuned from [mistralai/Mistral-7B-v0.1](https://huggingface.co/mistralai/Mistral-7B-v0.1) on 3k samples from the [laion/OIG](https://huggingface.co/datasets/laion/OIG) dataset. The training procedure involves supervised finetuning from TRL.


## Model description

- **Model type:** A 7B parameter LLM finetuned on 3k samples from [argilla/oig-30k](https://huggingface.co/datasets/argilla/oig-30k), originally from [laion/OIG](https://huggingface.co/datasets/laion/OIG).
- **Language(s) (NLP):** Primarily English
- **License:** Apache 2.0
- **Finetuned from model:** [mistralai/Mistral-7B-v0.1](https://huggingface.co/mistralai/Mistral-7B-v0.1)

## Usage

```python
from transformers import AutoTokenizer
from peft import AutoPeftModelForCausalLM
import torch

model_id = "argilla/Mistral-7B-v0.1-chat-OIG"
model = AutoPeftModelForCausalLM.from_pretrained(
    model_id,
    torch_dtype=torch.bfloat16,
    device_map="auto",
)
tokenizer = AutoTokenizer.from_pretrained(model_id)
tokenizer.pad_token_id = tokenizer.eos_token_id
text = "<human>: What were Nelson Mandela's relations with the ANC? <bot>:"
inputs = tokenizer(text, return_tensors="pt").to(model.device)

with torch.no_grad():
    outputs = model.generate(input_ids=inputs["input_ids"], max_new_tokens=250, pad_token_id=tokenizer.pad_token_id)
print(tokenizer.batch_decode(outputs, skip_special_tokens=False)[0])
```

### Prompt template
#### Single step
```
<s><human>: {prompt} <bot>: 
```
or
```
Background: {background} <s><human>: {prompt} <bot>: 
```
#### Multi-step
```
<s><human>: {prompt_1} <bot>: {response_1}</s><s><human>: {prompt_2} <bot>: {response_2}</s><s><human>: {prompt_3} <bot>: 
```
or
```
Background: {background} <s><human>: {prompt_1} <bot>: {response_1}</s><s><human>: {prompt_2} <bot>: {response_2}</s><s><human>: {prompt_3} <bot>: 
```

<!--
### Model Sources

- **Tutorial:** ...
-->

### Framework versions
- Transformers 4.34.0
- Pytorch 2.0.1+cu118
- Datasets 2.12.0
- Tokenizers 0.14.0
- PEFT 0.5.0