iansotnek commited on
Commit
22c1783
1 Parent(s): 23ffc88

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +141 -1
README.md CHANGED
@@ -1,4 +1,144 @@
1
- ---
2
  license: other
3
  commercial: false
 
 
 
 
 
4
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  license: other
2
  commercial: false
3
+ datasets:
4
+ - aisquared/databricks-dolly-15k
5
+ language:
6
+ - en
7
+ library_name: transformers
8
  ---
9
+
10
+
11
+ # Model Card for `chopt-1_3b`
12
+
13
+ <!-- Provide a quick summary of what the model is/does. -->
14
+
15
+ AI Squared's `chopt-1_3b` is a large language model which is derived from Meta AI's Open Pre-trained Transformer language modelsand fine-tuned on a corpus of 15k records ([Databricks' "Dolly 15k" Dataset](https://huggingface.co/datasets/aisquared/databricks-dolly-15k)) to help it exhibit chat-based capabilities. Despite the permissive license of the Dolly 15k dataset, due to this model being a derivative of OPT it is restricted to use for **non-commercial research purposes**. The ChOPT family of models from AI Squared are licensed under the OPT-175B license, Copyright (c) Meta Platforms, Inc. All Rights Reserved.
16
+
17
+ While `chopt-1_3b` is **not a state-of-the-art model**, we believe that the level of interactivity that can be achieved on such a small model that is trained so cheaply is important to showcase, as it continues to demonstrate that creating powerful AI capabilities may be much more accessible than previously thought.
18
+
19
+
20
+ ### Model Description
21
+
22
+ <!-- Provide a longer summary of what this model is. -->
23
+
24
+ - **Developed by:** AI Squared, Inc.
25
+ - **Shared by:** AI Squared, Inc.
26
+ - **Model type:** Large Language Model
27
+ - **Language(s) (NLP):** EN
28
+ - **License:** other
29
+ - **Finetuned from model:** OPT
30
+
31
+
32
+ ## Bias, Risks, and Limitations
33
+
34
+ <!-- This section is meant to convey both technical and sociotechnical limitations. -->
35
+
36
+ **`chopt-1_3b` is not a state-of-the-art language model.** `chopt-1_3b` is an experimental technology and is not designed for use in any
37
+ environment other than for research purposes. Furthermore, the model can sometimes exhibit undesired behaviors. Some of these behaviors include,
38
+ but are not limited to: factual inaccuracies, biases, offensive responses, toxicity, and hallucinations.
39
+ Just as with any other LLM, we advise users of this technology to exercise good judgment when applying this technology.
40
+
41
+
42
+ ## Usage
43
+
44
+ The code below shows how to use `chopt-1_3b` in the way which it was trained. While the model can be used "out of the box" using the
45
+ `transformers` library, using the function defined below to create a response from the model will achieve better results.
46
+
47
+ ### Load Model and Tokenizer from this Repository Using the `transformers` Package
48
+
49
+ ```python
50
+ from transformers import AutoModelForCausalLM, AutoTokenizer
51
+ import numpy as np
52
+ import re
53
+
54
+ model_id = 'aisquared/chopt-1_3b'
55
+
56
+ tokenizer = AutoTokenizer.from_pretrained(model_id, padding_side = 'left')
57
+ model = AutoModelForCausalLM.from_pretrained(model_id, trust_remote_code = True, device_map = 'auto')
58
+ ```
59
+
60
+
61
+ ### Create the Prompt Format and Other Variables
62
+
63
+ ```python
64
+ PROMPT = """Below is an instruction that describes a task. Write a response that appropriately completes the request.
65
+
66
+ ### Instruction:
67
+ {instruction}
68
+
69
+ ### Response:
70
+ """
71
+
72
+ END_KEY = '### End'
73
+ RESPONSE_KEY = '### Response:\n'
74
+ ```
75
+
76
+
77
+ ### Create a Function to Retrieve a Response
78
+
79
+ ```python
80
+ def create_response(
81
+ instruction,
82
+ model,
83
+ tokenizer,
84
+ do_sample = True,
85
+ max_new_tokens = 256,
86
+ top_p = 0.92,
87
+ top_k = 0,
88
+ **kwargs
89
+ ):
90
+ """
91
+ Create a response from the model by using a formatted prompt
92
+ """
93
+ input_ids = tokenizer(
94
+ PROMPT.format(instruction=instruction), return_tensors="pt"
95
+ ).input_ids
96
+
97
+ gen_tokens = model.generate(
98
+ input_ids,
99
+ pad_token_id=tokenizer.pad_token_id,
100
+ do_sample=do_sample,
101
+ max_new_tokens=max_new_tokens,
102
+ top_p=top_p,
103
+ top_k=top_k,
104
+ **kwargs,
105
+ )
106
+ decoded = tokenizer.batch_decode(gen_tokens)[0]
107
+
108
+ # The response appears after "### Response:". The model has been trained to append "### End" at the end.
109
+ m = re.search(r"#+\s*Response:\s*(.+?)#+\s*End", decoded, flags=re.DOTALL)
110
+
111
+ response = None
112
+ if m:
113
+ response = m.group(1).strip()
114
+ else:
115
+ # The model might not generate the "### End" sequence before reaching the max tokens. In this case, return
116
+ # everything after "### Response:".
117
+ m = re.search(r"#+\s*Response:\s*(.+)", decoded, flags=re.DOTALL)
118
+ if m:
119
+ response = m.group(1).strip()
120
+ else:
121
+ pass
122
+ return response
123
+ ```
124
+
125
+ ### Model Performance Metrics
126
+
127
+ We present the results from various model benchmarks on the EleutherAI LLM Evaluation Harness for all models in the ChOPT family.
128
+ Model results are sorted by mean score, ascending, to provide an ordering. These metrics serve to further show that none of the DLite models are
129
+ state of the art, but rather further show that chat-like behaviors in LLMs can be trained almost independent of model size.
130
+
131
+ | Model | openbookqa | arc_easy | winogrande | hellaswag | arc_challenge | piqa | boolq |
132
+ |:--------------------|-------------:|-----------:|-------------:|------------:|----------------:|---------:|---------:|
133
+ | chopt-125m | 0.178 | 0.443182 | 0.501973 | 0.294165 | 0.197099 | 0.630577 | 0.476758 |
134
+ | chopt-research-125m | 0.17 | 0.436027 | 0.503552 | 0.294762 | 0.205631 | 0.62568 | 0.48685 |
135
+ | opt-125m | 0.166 | 0.435606 | 0.501973 | 0.291775 | 0.190273 | 0.6284 | 0.554434 |
136
+ | chopt-350m | 0.178 | 0.450758 | 0.508287 | 0.325334 | 0.21843 | 0.650707 | 0.559633 |
137
+ | opt_350m | 0.176 | 0.441077 | 0.52644 | 0.320056 | 0.207338 | 0.645267 | 0.57737 |
138
+ | chopt-research-350m | 0.172 | 0.462542 | 0.514601 | 0.327524 | 0.235495 | 0.643634 | 0.589908 |
139
+ | opt-1.3b | 0.234 | 0.569865 | 0.596685 | 0.414957 | 0.232935 | 0.718172 | 0.577676 |
140
+ | chopt-research-1_3b | 0.232 | 0.564815 | 0.59116 | 0.424716 | 0.276451 | 0.713275 | 0.634557 |
141
+ | chopt-1_3b | 0.236 | 0.569444 | 0.584057 | 0.42621 | 0.268771 | 0.723069 | 0.658104 |
142
+ | opt-2.7b | 0.25 | 0.608165 | 0.608524 | 0.458176 | 0.267918 | 0.738303 | 0.603058 |
143
+ | chopt-2_7b | 0.276 | 0.616582 | 0.601421 | 0.472615 | 0.288396 | 0.75136 | 0.552294 |
144
+ | chopt-research-2_7b | 0.262 | 0.610269 | 0.625099 | 0.458176 | 0.295222 | 0.742111 | 0.636697 |