player1537 commited on
Commit
840d0ea
·
1 Parent(s): 2ac2b8b

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +150 -0
README.md ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ datasets:
3
+ - ehartford/dolphin
4
+ - player1537/Bloom-560m-trained-on-Dolphin
5
+ language:
6
+ - en
7
+ library_name: transformers
8
+ pipeline_tag: text-generation
9
+ ---
10
+
11
+ # Model Card for player1537/Dolphinette
12
+
13
+ Dolphinette is my latest attempt at creating a small LLM that is intended to
14
+ run locally on ones own laptop or cell phone. I believe that the area
15
+ of personalized LLMs will be one of the largest driving forces towards
16
+ widespread LLM usage.
17
+
18
+ Dolphinette is a fine-tuned version of
19
+ [bigscience/bloom-560m](https://huggingface.co/bigscience/bloom-560m),
20
+ trained using the
21
+ [ehartford/dolphin](https://huggingface.co/datasets/ehartford/dolphin)
22
+ dataset. The model was trained as a LoRA using [this Google Colab
23
+ notebook](https://gist.github.com/player1537/fbc82c720162626f460b1905e80a5810)
24
+ and then the LoRA was merged into the original model using [this Google
25
+ Colab
26
+ notebook](https://gist.github.com/player1537/3763fe92469306a0bd484940850174dc).
27
+
28
+
29
+ ## Uses
30
+
31
+ Dolphinette is trained to follow instructions and uses the following template:
32
+
33
+ > `<s>INSTRUCTION: You are an AI assistant that follows instruction extremely well. Help as much as you can. INPUT: Answer this question: what is the capital of France? OUTPUT:`
34
+
35
+ More formally, this function was used:
36
+
37
+ ```python
38
+ def __text(datum: Dict[Any, Any]=None, /, **kwargs) -> str:
39
+ r"""
40
+
41
+ >>> __text({
42
+ ... "instruction": "Test instruction.",
43
+ ... "input": "Test input.",
44
+ ... "output": "Test output.",
45
+ ... })
46
+ '<s>INSTRUCTION: Test instruction. INPUT: Test input. OUTPUT: Test output.</s>'
47
+
48
+ >>> __text({
49
+ ... "instruction": "Test instruction.",
50
+ ... "input": "Test input.",
51
+ ... "output": None,
52
+ ... })
53
+ '<s>INSTRUCTION: Test instruction. INPUT: Test input. OUTPUT:'
54
+
55
+ """
56
+
57
+ if datum is None:
58
+ datum = kwargs
59
+
60
+ return (
61
+ f"""<s>"""
62
+ f"""INSTRUCTION: {datum['instruction']} """
63
+ f"""INPUT: {datum['input']} """
64
+ f"""OUTPUT: {datum['output']}</s>"""
65
+ ) if datum.get('output', None) is not None else (
66
+ f"""<s>"""
67
+ f"""INSTRUCTION: {datum['instruction']} """
68
+ f"""INPUT: {datum['input']} """
69
+ f"""OUTPUT:"""
70
+ )
71
+ ```
72
+
73
+ From the original training set, the set of instructions and how many times they appeared is as follows.
74
+
75
+ - 165175: `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.`
76
+ - 136285: `You are a helpful assistant, who always provide explanation. Think like you are answering to a five year old.`
77
+ - 110127: `You are an AI assistant. You will be given a task. You must generate a detailed and long answer.`
78
+ - 63267: ` ` (nothing)
79
+ - 57303: `You are an AI assistant that follows instruction extremely well. Help as much as you can.`
80
+ - 51266: `You are an AI assistant. Provide a detailed answer so user don’t need to search outside to understand the answer.`
81
+ - 19146: `You are an AI assistant that helps people find information.`
82
+ - 18008: `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-bystep and justify your answer.`
83
+ - 17181: `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.`
84
+ - 9938: `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.`
85
+ - 8730: `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.`
86
+ - 8599: `Explain how you used the definition to come up with the answer.`
87
+ - 8459: `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.`
88
+ - 7401: `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
+ - 7212: `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.`
90
+ - 6372: `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.`
91
+ - 55: `You are an AI assistant. Provide a detailed answer so user don't need to search outside to understand the answer.`
92
+
93
+
94
+ ### Direct Use
95
+
96
+ Using the huggingface transformers library, you can use this model simply as:
97
+
98
+ ```python
99
+ import transformers
100
+
101
+ model = transformers.AutoModelForCausalLM.from_pretrained(
102
+ 'player1537/Dolphinette',
103
+ )
104
+
105
+ tokenizer = transformers.AutoTokenizer.from_pretrained(
106
+ 'player1537/Dolphinette',
107
+ )
108
+
109
+ pipeline = transformers.pipeline(
110
+ 'text-generation',
111
+ model=model,
112
+ tokenizer=tokenizer,
113
+ )
114
+
115
+ completion = pipeline(
116
+ (
117
+ r"""<s>INSTRUCTION: You are an AI assistant that helps people find"""
118
+ r"""information. INPUT: Answer this question: what is the capital of"""
119
+ r"""France? Be concise. OUTPUT:"""
120
+ ),
121
+ return_full_text=False,
122
+ max_new_tokens=512,
123
+ )
124
+ completion = completion[0]['generated_text']
125
+
126
+ print(completion)
127
+ #=> The capital of France is the city of Paris. It's located in the country of
128
+ #=> France, which means it's a geographical location in Europe. It is
129
+ #=> consistently called "La capitale de France" ("La capital de la France"),
130
+ #=> its localization literally refers to theThiest city of France.
131
+ #=>
132
+ #=> According to the English translation of the French, the capital is the place
133
+ #=> where people live for their livelihood or business. However, the actual
134
+ #=> location you are looking at is the capital of France, the city located in
135
+ #=> the center of the country along several important international routes.
136
+ #=>
137
+ #=> The capital of France generally refers to one or a few urban locations that
138
+ #=> represent particular cities in Europe. Depending on your nationality or
139
+ #=> culture, refinements can be added to the name of the city, and the
140
+ #=> announcement can be 'tel Aviv', 'Edinburgh', 'Corinthus', 'Palace of Culture
141
+ #=> and Imperials' (a French title), 'Languedoc', `Paris' or 'Belfast'.
142
+ #=>
143
+ #=> To be clear, the city of paris is the capital of France, and it is the
144
+ #=> geographical location of the city, not the city itself.
145
+ #=>
146
+ #=> Conclusion: The capital of France is the city of Paris, which is the
147
+ #=> most-visited international destination in Europe.
148
+ ```
149
+
150
+ This model is very wordy... But for less contrived tasks, I have found it to work well enough.