mariagrandury
commited on
Commit
•
a6aa676
1
Parent(s):
f4215fa
Update README.md
Browse files
README.md
CHANGED
@@ -7,47 +7,211 @@ 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 |
-
|
|
|
|
|
13 |
|
14 |
<div style="text-align:center;width:250px;height:250px;">
|
15 |
-
<img src="https://huggingface.co/clibrain/lince-zero/resolve/main/
|
16 |
</div>
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
-
|
20 |
|
21 |
-
|
22 |
|
23 |
-
|
24 |
|
|
|
25 |
|
26 |
-
|
27 |
|
28 |
-
|
29 |
|
|
|
30 |
|
31 |
-
###
|
32 |
|
33 |
-
|
34 |
|
35 |
-
|
36 |
|
37 |
-
|
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 = {
|
|
|
7 |
- es
|
8 |
thumbnail: https://huggingface.co/clibrain/lince-zero/resolve/main/lince_logo_1.png
|
9 |
pipeline_tag: text-generation
|
10 |
+
datasets:
|
11 |
+
- tatsu-lab/alpaca
|
12 |
+
- databricks/databricks-dolly-15k
|
13 |
+
library_name: transformers
|
14 |
---
|
15 |
|
16 |
+
LINCE (Llm for Instructions from Natural Corpus en Español) is a state-of-the-art Spanish instruction 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/blob/main/README.md)** 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 into Spanish.
|
17 |
+
|
18 |
+
The model is released under the Apache 2.0 license.
|
19 |
|
20 |
<div style="text-align:center;width:250px;height:250px;">
|
21 |
+
<img src="https://huggingface.co/clibrain/lince-zero/resolve/main/lince_logo_1.png" alt="lince logo"">
|
22 |
</div>
|
23 |
|
24 |
+
# Model Card for LINCE-ZERO
|
25 |
+
|
26 |
+
**LINCE-ZERO** is a model fine-tuned on a massive and original corpus of Spanish instructions.
|
27 |
+
|
28 |
+
# Table of Contents
|
29 |
+
|
30 |
+
- [Model Details](#model-details)
|
31 |
+
- [Model Description](#model-description)
|
32 |
+
- [Uses](#uses)
|
33 |
+
- [Direct Use](#direct-use)
|
34 |
+
- [Downstream Use](#downstream-use)
|
35 |
+
- [Out-of-Scope Use](#out-of-scope-use)
|
36 |
+
- [Bias, Risks, and Limitations](#bias-risks-and-limitations)
|
37 |
+
- [Recommendations](#recommendations)
|
38 |
+
- [Training Details](#training-details)
|
39 |
+
- [Training Data](#training-data)
|
40 |
+
- [Training Procedure](#training-procedure)
|
41 |
+
- [Preprocessing](#preprocessing)
|
42 |
+
- [Speeds, Sizes, Times](#speeds-sizes-times)
|
43 |
+
- [Evaluation](#evaluation)
|
44 |
+
- [Testing Data, Factors & Metrics](#testing-data-factors--metrics)
|
45 |
+
- [Testing Data](#testing-data)
|
46 |
+
- [Factors](#factors)
|
47 |
+
- [Metrics](#metrics)
|
48 |
+
- [Results](#results)
|
49 |
+
- [Model Examination](#model-examination)
|
50 |
+
- [Environmental Impact](#environmental-impact)
|
51 |
+
- [Technical Specifications](#technical-specifications)
|
52 |
+
- [Model Architecture and Objective](#model-architecture-and-objective)
|
53 |
+
- [Compute Infrastructure](#compute-infrastructure)
|
54 |
+
- [Hardware](#hardware)
|
55 |
+
- [Software](#software)
|
56 |
+
- [Citation](#citation)
|
57 |
+
- [Contact](#contact)
|
58 |
+
- [How to Get Started with the Model](#how-to-get-started-with-the-model)
|
59 |
+
|
60 |
+
# Model Details
|
61 |
+
|
62 |
+
## Model Description
|
63 |
+
|
64 |
+
LINCE-ZERO (Llm for Instructions from Natural Corpus en Español) is a state-of-the-art Spanish instruction 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/blob/main/README.md) 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 into Spanish.
|
65 |
+
|
66 |
+
- **Developed by:** [Clibrain](https://www.clibrain.com/)
|
67 |
+
- **Model type:** Language model, instruction model, causal decoder-only
|
68 |
+
- **Language(s) (NLP):** es
|
69 |
+
- **License:** apache-2.0
|
70 |
+
- **Parent Model:** [https://huggingface.co/tiiuae/falcon-7b](https://huggingface.co/tiiuae/falcon-7b)
|
71 |
+
- **Resources for more information:** Paper coming soon
|
72 |
+
|
73 |
+
## Model Sources
|
74 |
+
|
75 |
+
- **Paper**: Coming soon!
|
76 |
+
- **Demo**: Coming soon!
|
77 |
+
|
78 |
+
# Uses
|
79 |
+
|
80 |
+
## Direct Use
|
81 |
+
|
82 |
+
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.
|
83 |
+
|
84 |
+
Please note that running inference with LINCE-ZERO efficiently requires a minimum of XGB of memory.
|
85 |
+
|
86 |
+
## Downstream Use
|
87 |
+
|
88 |
+
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.
|
89 |
+
|
90 |
+
## Out-of-Scope Use
|
91 |
+
|
92 |
+
LINCE-ZERO should not be used for production purposes without conducting a thorough assessment of risks and mitigation strategies.
|
93 |
+
|
94 |
+
# Bias, Risks, and Limitations
|
95 |
+
|
96 |
+
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.
|
97 |
+
|
98 |
+
Since the model has been fine-tuned on translated versions of the Alpaca and Dolly datasets, it has potentially inherited certain limitations and biases:
|
99 |
+
|
100 |
+
- 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.
|
101 |
+
- 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.
|
102 |
+
|
103 |
+
## Recommendations
|
104 |
+
|
105 |
+
Please, when utilizing LINCE-ZERO, exercise caution and critically assess the output to mitigate the potential impact of biased or inaccurate information.
|
106 |
+
|
107 |
+
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.
|
108 |
+
|
109 |
+
# Training Details
|
110 |
+
|
111 |
+
## Training Data
|
112 |
+
|
113 |
+
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 into Spanish.
|
114 |
+
|
115 |
+
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).
|
116 |
+
|
117 |
+
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).
|
118 |
|
119 |
+
## Training Procedure
|
120 |
|
121 |
+
For detailed information about the model architecture and compute infrastructure, please refer to the Technical Specifications section.
|
122 |
|
123 |
+
### Preprocessing
|
124 |
|
125 |
+
To prepare the training data, both the Alpaca and Dolly datasets, originally in English, were translated into Spanish using …
|
126 |
|
127 |
+
The data was tokenized using LINCE-ZERO’s tokenizer, which is based on the Falcon-**[7B](https://huggingface.co/tiiuae/falcon-7b)**/**[40B](https://huggingface.co/tiiuae/falcon-40b)** tokenizer.
|
128 |
|
129 |
+
### Training Hyperparameters
|
130 |
|
131 |
+
More information needed
|
132 |
|
133 |
+
### Speeds, Sizes, Times
|
134 |
|
135 |
+
More information needed (throughput, start/end time, checkpoint size if relevant, etc.)
|
136 |
|
137 |
+
# Evaluation
|
138 |
|
139 |
+
## Testing Data, Factors & Metrics
|
140 |
|
141 |
+
### Testing Data
|
142 |
+
|
143 |
+
The model has been tested on a X% of the augmented combination of Alpaca (24.2 MB) and Dolly (13.1 MB) translated into Spanish.
|
144 |
+
|
145 |
+
### Metrics
|
146 |
+
|
147 |
+
Since LINCE-ZERO is an instruction model, the metrics used to evaluate it are:
|
148 |
+
|
149 |
+
- X: <value>
|
150 |
+
|
151 |
+
### Results
|
152 |
+
|
153 |
+
Paper coming soon. Meanwhile, check the [OpenLLM Leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard).
|
154 |
+
|
155 |
+
# Technical Specifications
|
156 |
+
|
157 |
+
## Model Architecture and Objective
|
158 |
+
|
159 |
+
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.
|
160 |
+
|
161 |
+
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:
|
162 |
+
|
163 |
+
- Positional embeddings: rotary (Su et al., 2021);
|
164 |
+
- Attention: multiquery (Shazeer et al., 2019) and FlashAttention (Dao et al., 2022);
|
165 |
+
- Decoder-block: parallel attention/MLP with a single-layer norm.
|
166 |
+
|
167 |
+
## Compute Infrastructure
|
168 |
+
|
169 |
+
### Hardware
|
170 |
+
|
171 |
+
LINCE-ZERO was trained on AWS SageMaker, on ... GPUs in ... instances.
|
172 |
+
|
173 |
+
### Software
|
174 |
+
|
175 |
+
More information needed
|
176 |
+
|
177 |
+
# Environmental Impact
|
178 |
+
|
179 |
+
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).
|
180 |
+
|
181 |
+
- **Hardware Type:** More information needed
|
182 |
+
- **Hours used:** More information needed
|
183 |
+
- **Cloud Provider:** More information needed
|
184 |
+
- **Compute Region:** More information needed
|
185 |
+
- **Carbon Emitted:** More information needed
|
186 |
+
|
187 |
+
# Citation
|
188 |
+
|
189 |
+
There is a paper coming soon! Meanwhile, when using LINCE-ZERO please use the following information to cite:
|
190 |
+
|
191 |
+
```markdown
|
192 |
+
@article{lince-zero,
|
193 |
+
title={{LINCE}: Llm for Instructions from Natural Corpus en Español},
|
194 |
+
author={},
|
195 |
+
year={2023}
|
196 |
+
}
|
197 |
+
```
|
198 |
+
|
199 |
+
# Contact
|
200 |
+
|
201 |
+
[[email protected]](mailto:[email protected])
|
202 |
+
|
203 |
+
# How to Get Started with LINCE-ZERO
|
204 |
+
|
205 |
+
Use the code below to get started with LINCE-ZERO 🔥
|
206 |
|
|
|
207 |
```py
|
208 |
import torch
|
209 |
from transformers import AutoModelForCausalLM, AutoTokenizer, AutoTokenizer
|
210 |
|
211 |
model_id = "clibrain/lince-zero"
|
212 |
|
|
|
|
|
213 |
model = AutoModelForCausalLM.from_pretrained(model_id).to("cuda")
|
214 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
215 |
|
216 |
def create_instruction(instruction, input_data=None, context=None):
|
217 |
sections = {
|