Fix missing import and closing parenthesis

#1
by dvilasuero HF staff - opened
Files changed (1) hide show
  1. README.md +161 -18
README.md CHANGED
@@ -5,50 +5,177 @@ model-index:
5
  license: apache-2.0
6
  language:
7
  - es
8
- thumbnail: https://huggingface.co/clibrain/lince-zero/resolve/main/lince_logo_1.png
9
  pipeline_tag: text-generation
 
 
 
 
 
10
  ---
11
 
12
- # Lince Zero 🐯
 
 
 
 
 
 
 
 
13
 
14
  <div style="text-align:center;width:250px;height:250px;">
15
  <img src="https://huggingface.co/clibrain/lince-zero/resolve/main/LINCE-CLIBRAIN-HD.jpg" alt="lince logo"">
16
  </div>
17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
 
19
- **Lince** is model fine-tuned on a massive and original corpus of Spanish instructions.
20
 
21
- ## Model description 🧠
22
 
23
- TBA
24
 
 
25
 
26
- ## Training and evaluation data 📚
27
 
28
- We created an instruction dataset following the format or popular datasets in the field such as *Alpaca* and *Dolly* and augmented it to reach **80k** samples.
29
 
 
30
 
31
- ### Training hyperparameters
32
 
33
- TBA
34
 
35
- ### Training results 🗒️
36
 
37
- TBA
38
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
 
40
- ### Example of usage 👩‍💻
41
  ```py
42
  import torch
43
- from transformers import AutoModelForCausalLM, AutoTokenizer, AutoTokenizer
44
 
45
  model_id = "clibrain/lince-zero"
46
 
 
47
  tokenizer = AutoTokenizer.from_pretrained(model_id)
48
 
49
- model = AutoModelForCausalLM.from_pretrained(model_id).to("cuda")
50
-
51
-
52
  def create_instruction(instruction, input_data=None, context=None):
53
  sections = {
54
  "Instrucción": instruction,
@@ -81,7 +208,7 @@ def generate(
81
  ):
82
 
83
  prompt = create_instruction(instruction, input, context)
84
- print(prompt)
85
  inputs = tokenizer(prompt, return_tensors="pt")
86
  input_ids = inputs["input_ids"].to("cuda")
87
  attention_mask = inputs["attention_mask"].to("cuda")
@@ -108,4 +235,20 @@ def generate(
108
 
109
  instruction = "Dame una lista de lugares a visitar en España."
110
  print(generate(instruction))
111
- ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  license: apache-2.0
6
  language:
7
  - es
8
+ thumbnail: https://huggingface.co/clibrain/lince-zero/resolve/main/LINCE-CLIBRAIN-HD.jpg
9
  pipeline_tag: text-generation
10
+ datasets:
11
+ - tatsu-lab/alpaca
12
+ - databricks/databricks-dolly-15k
13
+ library_name: transformers
14
+ inference: false
15
  ---
16
 
17
+ # Model Card for LINCE-ZERO
18
+
19
+ **LINCE-ZERO** (Llm for Instructions from Natural Corpus en Español) is a SOTA Spanish instruction-tuned LLM 🔥
20
+
21
+ Developed by [Clibrain](https://www.clibrain.com/), it is a causal decoder-only model with 7B parameters. LINCE-ZERO is based on [Falcon-7B](https://huggingface.co/tiiuae/falcon-7b) and has been fine-tuned using a combination of the [Alpaca](https://huggingface.co/datasets/tatsu-lab/alpaca) and [Dolly](https://huggingface.co/datasets/databricks/databricks-dolly-15k) datasets, both translated into Spanish and augmented to 80k examples.
22
+
23
+ The model is released under the Apache 2.0 license.
24
+
25
+ If you want to test the robust 40B parameters version called **LINCE**, you can request access at [[email protected]](mailto:[email protected]). Be one of the first to discover the possibilities of LINCE!
26
 
27
  <div style="text-align:center;width:250px;height:250px;">
28
  <img src="https://huggingface.co/clibrain/lince-zero/resolve/main/LINCE-CLIBRAIN-HD.jpg" alt="lince logo"">
29
  </div>
30
 
31
+ <br />
32
+
33
+ # Table of Contents
34
+
35
+ - [Model Details](#model-details)
36
+ - [Model Description](#model-description)
37
+ - [Uses](#uses)
38
+ - [Direct Use](#direct-use)
39
+ - [Downstream Use](#downstream-use)
40
+ - [Out-of-Scope Use](#out-of-scope-use)
41
+ - [Bias, Risks, and Limitations](#bias-risks-and-limitations)
42
+ - [Recommendations](#recommendations)
43
+ - [Training Details](#training-details)
44
+ - [Training Data](#training-data)
45
+ - [Evaluation](#evaluation)
46
+ - [Results](#results)
47
+ - [Environmental Impact](#environmental-impact)
48
+ - [Technical Specifications](#technical-specifications)
49
+ - [Model Architecture and Objective](#model-architecture-and-objective)
50
+ - [Compute Infrastructure](#compute-infrastructure)
51
+ - [Hardware](#hardware)
52
+ - [Software](#software)
53
+ - [How to Get Started with the Model](#how-to-get-started-with-the-model)
54
+ - [Citation](#citation)
55
+ - [Contact](#contact)
56
+
57
+ # 🐯 Model Details
58
+
59
+ ## Model Description
60
+
61
+ LINCE-ZERO (Llm for Instructions from Natural Corpus en Español) is a state-of-the-art Spanish instruction-tuned large language model. Developed by [Clibrain](https://www.clibrain.com/), it is a causal decoder-only model with 7B parameters. LINCE-ZERO is based on [Falcon-7B](https://huggingface.co/tiiuae/falcon-7b) and has been fine-tuned using an 80k examples augmented combination of the [Alpaca](https://huggingface.co/datasets/tatsu-lab/alpaca) and [Dolly](https://huggingface.co/datasets/databricks/databricks-dolly-15k) datasets, both translated into Spanish.
62
+
63
+ - **Developed by:** [Clibrain](https://www.clibrain.com/)
64
+ - **Model type:** Language model, instruction model, causal decoder-only
65
+ - **Language(s) (NLP):** es
66
+ - **License:** apache-2.0
67
+ - **Parent Model:** https://huggingface.co/tiiuae/falcon-7b
68
+
69
+ ## Model Sources
70
+
71
+ - **Paper**: Coming soon! ✨
72
+ - **Demo**: [LINCE CHAT](https://huggingface.co/spaces/clibrain/lince-chat) ✨
73
+
74
+ # 💡 Uses
75
+
76
+ ## Direct Use
77
+
78
+ LINCE-ZERO's fine-tuning on an instructions dataset enables it to follow natural language instructions in Spanish. The direct use cases include virtual assistants and content generation.
79
+
80
+ <!--
81
+ Please note that running inference with LINCE-ZERO efficiently requires a minimum of XGB of memory.
82
+ -->
83
+
84
+ ## Downstream Use
85
+
86
+ LINCE-ZERO is an instruct model, it’s primarily intended for direct use and may not be ideal for further fine-tuning. It serves as a general model suitable for a wide range of applications. However, for specific use cases within certain domains, fine-tuning with domain-specific data may improve LINCE-ZERO's performance.
87
+
88
+ ## Out-of-Scope Use
89
+
90
+ LINCE-ZERO should not be used for production purposes without conducting a thorough assessment of risks and mitigation strategies.
91
+
92
+ # ⚠️ Bias, Risks, and Limitations
93
+
94
+ LINCE-ZERO has limitations associated with both the underlying language model and the instruction tuning data. It is crucial to acknowledge that predictions generated by the model may inadvertently exhibit common deficiencies of language models, including hallucination, toxicity, and perpetuate harmful stereotypes across protected classes, identity characteristics, and sensitive, social, and occupational groups.
95
+
96
+ Since the model has been fine-tuned on translated versions of the Alpaca and Dolly datasets, it has potentially inherited certain limitations and biases:
97
+
98
+ - Alpaca: The Alpaca dataset is generated by a language model (`text-davinci-003`) and inevitably contains some errors or biases inherent in that model. As the authors report, hallucination seems to be a common failure mode for Alpaca, even compared to `text-davinci-003`.
99
+ - Dolly: The Dolly dataset incorporates information from Wikipedia, which is a crowdsourced corpus. Therefore, the dataset's contents may reflect the biases, factual errors, and topical focus present in Wikipedia. Additionally, annotators involved in the dataset creation may not be native English speakers, and their demographics and subject matter may reflect the makeup of Databricks employees.
100
+
101
+ ## Recommendations
102
 
103
+ Please, when utilizing LINCE-ZERO, exercise caution and critically assess the output to mitigate the potential impact of biased or inaccurate information.
104
 
105
+ If considering LINCE-ZERO for production use, it is crucial to thoroughly evaluate the associated risks and adopt suitable precautions. Conduct a comprehensive assessment to address any potential biases and ensure compliance with legal and ethical standards.
106
 
107
+ # 📚 Training Details
108
 
109
+ ## Training Data
110
 
111
+ LINCE-ZERO is based on [Falcon-7B](https://huggingface.co/tiiuae/falcon-7b) and has been fine-tuned using an augmented combination of the [Alpaca](https://huggingface.co/datasets/tatsu-lab/alpaca) and [Dolly](https://huggingface.co/datasets/databricks/databricks-dolly-15k) datasets, both translated with the best quality into Spanish.
112
 
113
+ Alpaca is a 24.2 MB dataset of 52,002 instructions and demonstrations in English. It was generated by OpenAI's `text-davinci-003` engine using the data generation pipeline from the [Self-Instruct framework](https://github.com/yizhongw/self-instruct) with some modifications. For further details, refer to [Alpaca's Data Card](https://huggingface.co/datasets/tatsu-lab/alpaca).
114
 
115
+ Dolly is a 13.1 MB dataset of 15,011 instruction-following records in American English. It was generated by thousands of Databricks employees, who were requested to provide reference texts copied from Wikipedia for specific categories. To learn more, consult [Dolly’s Data Card](https://huggingface.co/datasets/databricks/databricks-dolly-15k).
116
 
117
+ After combining both translations, the dataset was augmented to reach a total of 80k examples.
118
 
 
119
 
120
+ # Evaluation
121
 
122
+ We are evaluating the model and will publish the results soon.
123
 
124
+ ### Results
125
+
126
+ Paper coming soon! Meanwhile, check the [OpenLLM Leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard).
127
+
128
+ # ⚙️ Technical Specifications
129
+
130
+ ## Model Architecture and Objective
131
+
132
+ LINCE-ZERO is a causal decoder-only model trained on a causal language modeling task. Its objective is to predict the next token in a sequence based on the context provided.
133
+
134
+ The architecture of LINCE-ZERO is based on Falcon-7B, which itself is adapted from the GPT-3 paper (Brown et al., 2020) with the following modifications:
135
+
136
+ - Positional embeddings: rotary (Su et al., 2021);
137
+ - Attention: multiquery (Shazeer et al., 2019) and FlashAttention (Dao et al., 2022);
138
+ - Decoder-block: parallel attention/MLP with a single-layer norm.
139
+
140
+ ## Compute Infrastructure
141
+
142
+ ### Hardware
143
+
144
+ LINCE-ZERO was trained using a GPU A100 with 40 GB during 8h.
145
+
146
+ ### Software
147
+
148
+ We used the following libraries:
149
+ - transformers
150
+ - accelerate
151
+ - peft
152
+ - bitsandbytes
153
+ - einops
154
+
155
+ # 🌳 Environmental Impact
156
+
157
+ Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
158
+
159
+ - **Hardware Type:** 1 X A100 - 40 GB
160
+ - **Hours used:** 8
161
+ - **Cloud Provider:** Google
162
+ - **Compute Region:** Europe
163
+ - **Carbon Emitted:** 250W x 10h = 2.5 kWh x 0.57 kg eq. CO2/kWh = 1.42 kg eq. CO2
164
+
165
+
166
+ # 🔥 How to Get Started with LINCE-ZERO
167
+
168
+ Use the code below to get started with LINCE-ZERO!
169
 
 
170
  ```py
171
  import torch
172
+ from transformers import AutoModelForCausalLM, AutoTokenizer, AutoTokenizer, GenerationConfig
173
 
174
  model_id = "clibrain/lince-zero"
175
 
176
+ model = AutoModelForCausalLM.from_pretrained(model_id, trust_remote_code=True).to("cuda")
177
  tokenizer = AutoTokenizer.from_pretrained(model_id)
178
 
 
 
 
179
  def create_instruction(instruction, input_data=None, context=None):
180
  sections = {
181
  "Instrucción": instruction,
 
208
  ):
209
 
210
  prompt = create_instruction(instruction, input, context)
211
+ print(prompt.replace("### Respuesta:\n", ""))
212
  inputs = tokenizer(prompt, return_tensors="pt")
213
  input_ids = inputs["input_ids"].to("cuda")
214
  attention_mask = inputs["attention_mask"].to("cuda")
 
235
 
236
  instruction = "Dame una lista de lugares a visitar en España."
237
  print(generate(instruction))
238
+ ```
239
+
240
+ # 📝 Citation
241
+
242
+ There is a paper coming soon! Meanwhile, when using LINCE-ZERO please use the following information to cite:
243
+
244
+ ```markdown
245
+ @article{lince-zero,
246
+ title={{LINCE-ZERO}: Llm for Instructions from Natural Corpus en Español},
247
+ author={clibrain.com},
248
+ year={2023}
249
+ }
250
+ ```
251
+
252
+ # 📧 Contact
253
+
254