Wonseop Kim commited on
Commit
b31dcd2
1 Parent(s): f05616d

Fix README.md

Browse files
Files changed (1) hide show
  1. README.md +84 -25
README.md CHANGED
@@ -1,40 +1,99 @@
1
  ---
 
 
 
 
 
2
  tags:
3
- - autotrain
4
- - text-generation
5
- widget:
6
- - text: "I love AutoTrain because "
7
- license: other
 
8
  ---
 
9
 
10
- # Model Trained Using AutoTrain
11
 
12
- This model was trained using AutoTrain. For more information, please visit [AutoTrain](https://hf.co/docs/autotrain).
13
 
14
- # Usage
15
 
16
- ```python
 
17
 
18
- from transformers import AutoModelForCausalLM, AutoTokenizer
19
 
20
- model_path = "PATH_TO_THIS_REPO"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
 
22
- tokenizer = AutoTokenizer.from_pretrained(model_path)
23
- model = AutoModelForCausalLM.from_pretrained(
24
- model_path,
25
- device_map="auto",
26
- torch_dtype='auto'
27
- ).eval()
28
 
29
- # Prompt content: "hi"
 
 
 
 
30
  messages = [
31
- {"role": "user", "content": "hi"}
 
 
32
  ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
 
34
- input_ids = tokenizer.apply_chat_template(conversation=messages, tokenize=True, add_generation_prompt=True, return_tensors='pt')
35
- output_ids = model.generate(input_ids.to('cuda'))
36
- response = tokenizer.decode(output_ids[0][input_ids.shape[1]:], skip_special_tokens=True)
37
 
38
- # Model response: "Hello! How can I assist you today?"
39
- print(response)
40
- ```
 
1
  ---
2
+ license: cc-by-4.0
3
+ pipeline_tag: text-generation
4
+ language:
5
+ - en
6
+ - ko
7
  tags:
8
+ - finetuned
9
+ - text-generation
10
+ datasets:
11
+ - royboy0416/ko-alpaca
12
+
13
+ inference: false
14
  ---
15
+ # Model Card for Mistral-7B-Instruct-v0.2-Ko-S-Core
16
 
17
+ ## Model Details
18
 
19
+ * **Backbone Model**: [Mistral-7B-Instruct-v0.2](mistralai/Mistral-7B-Instruct-v0.2)
20
 
21
+ ## Dataset Details
22
 
23
+ ### Used Datasets
24
+ - royboy0416/ko-alpaca
25
 
 
26
 
27
+ ----------------------------------------------------------------------
28
+
29
+ # Model Card for Mistral-7B-Instruct-v0.2
30
+
31
+ The Mistral-7B-Instruct-v0.2 Large Language Model (LLM) is an improved instruct fine-tuned version of [Mistral-7B-Instruct-v0.1](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.1).
32
+
33
+ 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/).
34
+
35
+ ## Instruction format
36
+
37
+ 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.
38
+
39
+ E.g.
40
+ ```
41
+ text = "<s>[INST] What is your favourite condiment? [/INST]"
42
+ "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> "
43
+ "[INST] Do you have mayonnaise recipes? [/INST]"
44
+ ```
45
 
46
+ This format is available as a [chat template](https://huggingface.co/docs/transformers/main/chat_templating) via the `apply_chat_template()` method:
 
 
 
 
 
47
 
48
+ ```python
49
+ from transformers import AutoModelForCausalLM, AutoTokenizer
50
+ device = "cuda" # the device to load the model onto
51
+ model = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-Instruct-v0.2")
52
+ tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-Instruct-v0.2")
53
  messages = [
54
+ {"role": "user", "content": "What is your favourite condiment?"},
55
+ {"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!"},
56
+ {"role": "user", "content": "Do you have mayonnaise recipes?"}
57
  ]
58
+ encodeds = tokenizer.apply_chat_template(messages, return_tensors="pt")
59
+ model_inputs = encodeds.to(device)
60
+ model.to(device)
61
+ generated_ids = model.generate(model_inputs, max_new_tokens=1000, do_sample=True)
62
+ decoded = tokenizer.batch_decode(generated_ids)
63
+ print(decoded[0])
64
+ ```
65
+
66
+ ## Model Architecture
67
+ This instruction model is based on Mistral-7B-v0.1, a transformer model with the following architecture choices:
68
+ - Grouped-Query Attention
69
+ - Sliding-Window Attention
70
+ - Byte-fallback BPE tokenizer
71
+
72
+ ## Troubleshooting
73
+ - If you see the following error:
74
+ ```
75
+ Traceback (most recent call last):
76
+ File "", line 1, in
77
+ File "/transformers/models/auto/auto_factory.py", line 482, in from_pretrained
78
+ config, kwargs = AutoConfig.from_pretrained(
79
+ File "/transformers/models/auto/configuration_auto.py", line 1022, in from_pretrained
80
+ config_class = CONFIG_MAPPING[config_dict["model_type"]]
81
+ File "/transformers/models/auto/configuration_auto.py", line 723, in getitem
82
+ raise KeyError(key)
83
+ KeyError: 'mistral'
84
+ ```
85
+
86
+ Installing transformers from source should solve the issue
87
+ pip install git+https://github.com/huggingface/transformers
88
+
89
+ This should not be required after transformers-v4.33.4.
90
+
91
+ ## Limitations
92
+
93
+ The Mistral 7B Instruct model is a quick demonstration that the base model can be easily fine-tuned to achieve compelling performance.
94
+ It does not have any moderation mechanisms. We're looking forward to engaging with the community on ways to
95
+ make the model finely respect guardrails, allowing for deployment in environments requiring moderated outputs.
96
 
97
+ ## The Mistral AI Team
 
 
98
 
99
+ 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.