Asif Ahmad commited on
Commit
4605b8f
1 Parent(s): 2b55a41

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +177 -0
README.md ADDED
@@ -0,0 +1,177 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ datasets:
4
+ - ehartford/dolphin
5
+ - shahules786/orca-chat
6
+ - togethercomputer/RedPajama-Data-1T
7
+ - atom-in-the-universe/fanfics-10k-50k
8
+ language:
9
+ - en
10
+ tags:
11
+ - sft
12
+ pipeline_tag: text-generation
13
+ widget:
14
+ - text: <|system|>You are an AI assistant. You will be given a task. You must generate a detailed and long answer.</s><|prompter|>What is a meme, and what's the history behind this word?</s><|assistant|>
15
+ - text: <|system|>You are an AI assistant that helps people find information.</s><|prompter|>What's the Earth total population</s><|assistant|>
16
+ - text: <|system|>You are an AI assistant that follows instruction extremely well. Help as much as you can.</s><|prompter|>Write a story about future of AI development</s><|assistant|>
17
+ ---
18
+ # llama2-13b-orca-8k-3319
19
+
20
+ ## Model Description
21
+
22
+ This model is a fine-tuning of Meta's Llama2 13B model with 8K context size on a long-conversation variant of the Dolphin dataset ([orca-chat](https://huggingface.co/datasets/shahules786/orca-chat)).
23
+
24
+ Note: **At least Huggingface Transformers [4.31.0](https://pypi.org/project/transformers/4.31.0/) is required to load this model!**
25
+
26
+
27
+ ## Usage
28
+
29
+ ```python
30
+ import torch
31
+ from transformers import AutoModelForCausalLM, AutoTokenizer
32
+
33
+ tokenizer = AutoTokenizer.from_pretrained("OpenAssistant/llama2-13b-orca-8k-3319", use_fast=False)
34
+ model = AutoModelForCausalLM.from_pretrained("OpenAssistant/llama2-13b-orca-8k-3319", torch_dtype=torch.float16, low_cpu_mem_usage=True, device_map="auto")
35
+
36
+ system_message = "You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature. If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information."
37
+ user_prompt = "Write me a poem please"
38
+ prompt = f"""<|system|>{system_message}</s><|prompter|>{user_prompt}</s><|assistant|>"""
39
+ inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
40
+ output = model.generate(**inputs, do_sample=True, top_p=0.95, top_k=0, max_new_tokens=256)
41
+ print(tokenizer.decode(output[0], skip_special_tokens=True))
42
+ ```
43
+
44
+ ## Model Details
45
+
46
+ - base model: [meta-llama/Llama-2-7b](https://huggingface.co/meta-llama/Llama-2-7b)
47
+ - License: [Llama 2 Community License Agreement](https://ai.meta.com/resources/models-and-libraries/llama-downloads/)
48
+ - sampling report: [2023-07-25_OpenAssistant_llama2-13b-orca-8k-3319_sampling_llama2_prompt.json](https://open-assistant.github.io/oasst-model-eval/?f=https%3A%2F%2Fraw.githubusercontent.com%2FOpen-Assistant%2Foasst-model-eval%2Fmain%2Fsampling_reports%2Foasst-pretrained%2F2023-07-25_OpenAssistant_llama2-13b-orca-8k-3319_sampling_llama2_prompt.json)
49
+ - wandb: [public-sft/runs/2jfazjt9](https://wandb.ai/open-assistant/public-sft/runs/2jfazjt9)
50
+ - checkpoint: 3319 steps
51
+ - datatpye: fp16
52
+ - sponsored by: [Redmond.ai](https://redmond.ai/)
53
+
54
+ ## Long context (RoPE Scaling)
55
+
56
+ This model was fine-tuned with a context size of 8192 tokens using linear scaling of RoPE embeddings. This feature was recently
57
+ added to [Huggingface transformers](https://github.com/huggingface/transformers/). Before loading this model please make sure
58
+ HF transformers >=4.31.0 is installed (`pip install transformers>=4.31.0`).
59
+
60
+ ## Conversation Template
61
+
62
+ For the initial response use (e.g. the [llama2 default system prompt](https://github.com/facebookresearch/llama/blob/6c7fe276574e78057f917549435a2554000a876d/llama/generation.py#L46) works well):
63
+
64
+ ```
65
+ <|system|>system message</s><|prompter|>user prompt</s><|assistant|>
66
+ ```
67
+
68
+ For multi-turn conversations use:
69
+
70
+ ```
71
+ <|system|>system message</s><|prompter|>Q1</s><|assistant|>A1</s><|prompter|>Q2</s><|assistant|>
72
+ ```
73
+
74
+ The model was trained with the following 15 system messages used to generate the training examples (see [ORCA paper](https://arxiv.org/abs/2306.02707)):
75
+
76
+ 1. You are an AI assistant. Provide a detailed answer so user don’t need to search outside to understand the answer.
77
+ 2. You are an AI assistant. You will be given a task. You must generate a detailed and long answer.
78
+ 3. You are a helpful assistant, who always provide explanation. Think like you are answering to a five year old.
79
+ 4. You are an AI assistant that follows instruction extremely well. Help as much as you can.
80
+ 5. You are an AI assistant that helps people find information. Provide a detailed answer so user don’t need to search outside to understand the answer.
81
+ 6. You are an AI assistant. User will you give you a task. Your goal is to complete the task as faithfully as you can. While performing the task think step-by-step and justify your steps.
82
+ 7. You should describe the task and explain your answer. While answering a multiple choice question, first output the correct answer(s). Then explain why other answers are wrong. Think like you are answering to a five year old.
83
+ 8. Explain how you used the definition to come up with the answer.
84
+ 9. You are an AI assistant. You should describe the task and explain your answer. While answering a multiple choice question, first output the correct answer(s). Then explain why other answers are wrong. You might need to use additional knowledge to answer the question.
85
+ 10. You are an AI assistant that helps people find information. User will you give you a question. Your task is to answer as faithfully as you can. While answering think step-by- step and justify your answer.
86
+ 11. User will you give you a task with some instruction. Your job is follow the instructions as faithfully as you can. While answering think step-by-step and justify your answer.
87
+ 12. You are a teacher. Given a task, you explain in simple steps what the task is asking, any guidelines it provides and how to use those guidelines to find the answer.
88
+ 13. You are an AI assistant, who knows every language and how to translate one language to another. Given a task, you explain in simple steps what the task is asking, any guidelines that it provides. You solve the task and show how you used the guidelines to solve the task.
89
+ 14. Given a definition of a task and a sample input, break the definition into small parts. Each of those parts will have some instruction. Explain their meaning by showing an example that meets the criteria in the instruction. Use the following format: Part \#: a key part of the definition. Usage: Sample response that meets the criteria from the key part. Explain why you think it meets the criteria.
90
+ 15. You are an AI assistant that helps people find information.
91
+
92
+
93
+ ## Datasets: Orca-Chat/Dolphin, RedPajama1T & FanFics
94
+
95
+ This model was trained on:
96
+
97
+ - [shahules786/orca-chat](https://huggingface.co/datasets/shahules786/orca-chat)
98
+ - [togethercomputer/RedPajama-Data-1T-Sample](https://huggingface.co/datasets/togethercomputer/RedPajama-Data-1T)
99
+ - [atom-in-the-universe/fanfics-10k-50k](https://huggingface.co/datasets/atom-in-the-universe/fanfics-10k-50k)
100
+
101
+ ```
102
+ Dataset Composition:
103
+ Tain (sampled):
104
+ orca-chat: 188842 (100%)
105
+ fanfics: 47760 (100%)
106
+ red_pajama: 188262 (25%)
107
+ Valid:
108
+ orca-chat: 5000
109
+ fanfics: 1000
110
+ red_pajama: 1000
111
+ ```
112
+
113
+ The dataset [shahules786/orca-chat](https://huggingface.co/datasets/shahules786/orca-chat) combines similar examples of the GPT-4 subset of [ehartford/dolphin](https://huggingface.co/datasets/ehartford/dolphin) to form longer conversations
114
+ to improve long-context training.
115
+
116
+ Additionally, RedPajama and FanFics were used for classic language modelling as an auxiliary task to improve the RoPE scaling for the 8k context size.
117
+
118
+
119
+ ## Model Configuration
120
+ ```
121
+ llama2_13b_orca_8k:
122
+ rng_seed: 0xe1291f1a
123
+ use_custom_sampler: true
124
+ sort_by_length: false
125
+ dtype: fp16
126
+ log_dir: "llama2_log_13b_orca_8k"
127
+ learning_rate: 1e-5
128
+ model_name: /mnt/data/llama2/Llama-2-13b-hf/
129
+ output_dir: llama2_13b_orca_8k
130
+ deepspeed_config: configs/zero_config_pretrain.json
131
+ weight_decay: 0.0
132
+ max_length: 8192
133
+ warmup_steps: 100
134
+ use_flash_attention: true
135
+ gradient_checkpointing: true
136
+ gradient_accumulation_steps: 8
137
+ per_device_train_batch_size: 2
138
+ per_device_eval_batch_size: 1
139
+ residual_dropout: 0.0
140
+ eval_steps: 200
141
+ save_steps: 1000 # (total steps: 3319)
142
+ num_train_epochs: 1
143
+ save_total_limit: 4
144
+ superhot: true
145
+ superhot_config:
146
+ type: linear
147
+ scale: 2
148
+ datasets:
149
+ - orca-chat:
150
+ max_val_set: 5000
151
+ - fanfics:
152
+ max_chunk_size: 65535
153
+ max_val_set: 1000
154
+ - red_pajama:
155
+ fraction: 0.25
156
+ max_val_set: 1000
157
+ max_chunk_size: 65535
158
+ peft_model: false
159
+ ```
160
+
161
+ # Developers
162
+
163
+ - [shahules786](https://github.com/shahules786)
164
+ - [jordiclive](https://github.com/jordiclive)
165
+ - [andreaskoepf](https://github.com/andreaskoepf/)
166
+
167
+ # Special Thanks
168
+
169
+ We want to especially thank Eric Hartford who spared no expense in replicating ORCA and making it available at [ehartford/dolphin](https://huggingface.co/datasets/ehartford/dolphin)!
170
+ Also, shoutout to the whole team working on [LLongMA-2-13b](https://huggingface.co/conceptofmind/LLongMA-2-13b) & the [scaled-rope](https://github.com/jquesnelle/scaled-rope) repository for their awesome work: bloc97, jquesnelle & conceptofmind!
171
+
172
+ The whole Open-Assistant team is very grateful for the continued support of [Redmond.ai](https://redmond.ai/) who sponsored the training compute required for this model.
173
+
174
+ # License
175
+
176
+ - Llama 2 is licensed under the LLAMA 2 Community License, Copyright © Meta Platforms, Inc. All Rights Reserved.
177
+ - Your use of the Llama Materials must comply with applicable laws and regulations (including trade compliance laws and regulations) and adhere to the [Acceptable Use Policy](https://ai.meta.com/llama/use-policy) for the Llama Materials.