Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,110 @@
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
+
language:
|
| 4 |
+
- ca
|
| 5 |
+
- es
|
| 6 |
+
- en
|
| 7 |
+
tags:
|
| 8 |
+
- RAG
|
| 9 |
+
pipeline_tag: text-generation
|
| 10 |
---
|
| 11 |
+
|
| 12 |
+
# FLOR-1.3B Model optimized for QA
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
## Table of Contents
|
| 16 |
+
<details>
|
| 17 |
+
<summary>Click to expand</summary>
|
| 18 |
+
|
| 19 |
+
- [Model description](#model-description)
|
| 20 |
+
- [Intended uses and limitations](#intended-uses-and-limitations)
|
| 21 |
+
- [How to use](#how-to-use)
|
| 22 |
+
- [Limitations and bias](#limitations-and-bias)
|
| 23 |
+
- [Training](#training)
|
| 24 |
+
- [Evaluation](#evaluation)
|
| 25 |
+
- [Additional information](#additional-information)
|
| 26 |
+
|
| 27 |
+
</details>
|
| 28 |
+
|
| 29 |
+
## Model description
|
| 30 |
+
|
| 31 |
+
**Flor1.3RAG** is a 6.3B-parameter transformer-based causal language model for Catalan, Spanish, and English, trained on 3 epochs on a customized QA dataset from various sources especifically to be used in RAG (Retrieval-Aumented Generation) Applications.
|
| 32 |
+
The dataset used to fine tune the model is: [PureInstructQA](https://huggingface.co/datasets/projecte-aina/PureInstructQA)
|
| 33 |
+
## Intended uses and limitations
|
| 34 |
+
|
| 35 |
+
The **Flor1.3RAG** model is ready-to-use for RAG applications optimized for Catalan language.
|
| 36 |
+
It can perform text-generation Question Answering in the context of RAG applications. This model does not require a GPU to run.
|
| 37 |
+
|
| 38 |
+
## How to use
|
| 39 |
+
```python
|
| 40 |
+
import torch
|
| 41 |
+
from transformers import pipeline
|
| 42 |
+
|
| 43 |
+
pipe = pipeline("text-generation", model="projecte-aina/Flor1.3RAG")
|
| 44 |
+
|
| 45 |
+
instruction = "Quants habitants t茅 Matar贸?"
|
| 46 |
+
|
| 47 |
+
context = "Matar贸 茅s una ciutat de Catalunya, capital de la comarca del Maresme. Situada al litoral mediterrani, a uns 30 km al nord-est de Barcelona, ha estat tradicionalment un centre administratiu de rellev脿ncia territorial i un pol de dinamisme econ貌mic. Compta amb prop de 130.000 habitants, essent actualment la vuitena poblaci贸 del Principat i la tretzena dels Pa茂sos Catalans. "
|
| 48 |
+
|
| 49 |
+
# We need to format the prompt and context using ### and \n
|
| 50 |
+
|
| 51 |
+
def givePrediction(instruction, context, max_new_tokens=50, repetition_penalty=1.2, top_k=50, top_p=0.95, do_sample=True, temperature=0.5)
|
| 52 |
+
text = f"### Instruction\n{{instruction}}\n### Context\n{{context}}\n### Answer\n"
|
| 53 |
+
response = pipe(text.format(instruction=instruction, context=context),temperature=temperature,repetition_penalty=repetition_penalty, max_new_tokens=max_new_tokens,top_k=top_k, top_p=top_p, do_sample=do_sample)[0]["generated_text"]
|
| 54 |
+
answer = response.split("###")[-1][8:-1]
|
| 55 |
+
return answer
|
| 56 |
+
|
| 57 |
+
answer = givePrediction(instruction, context)
|
| 58 |
+
|
| 59 |
+
print(answer)
|
| 60 |
+
'130 000'
|
| 61 |
+
|
| 62 |
+
```
|
| 63 |
+
|
| 64 |
+
## Limitations and bias
|
| 65 |
+
At the time of submission, no measures have been taken to estimate the bias and toxicity embedded in the model.
|
| 66 |
+
However, we are well aware that our models may be biased since the corpora have been collected using crawling techniques
|
| 67 |
+
on multiple web sources. We intend to conduct research in these areas in the future, and if completed, this model card will be updated.
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
## Training
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
### Instruction Data
|
| 74 |
+
|
| 75 |
+
The training corpus is composed of 82,539 QA instruction following examples. See Data Card at [PureInstructQA](https://huggingface.co/datasets/projecte-aina/PureInstructQA).
|
| 76 |
+
|
| 77 |
+
## Additional information
|
| 78 |
+
|
| 79 |
+
### Author
|
| 80 |
+
The Language Technologies Unit from Barcelona Supercomputing Center.
|
| 81 |
+
|
| 82 |
+
### Contact
|
| 83 |
+
For further information, please send an email to <langtech@bsc.es>.
|
| 84 |
+
|
| 85 |
+
### Copyright
|
| 86 |
+
Copyright(c) 2023 by Language Technologies Unit, Barcelona Supercomputing Center.
|
| 87 |
+
|
| 88 |
+
### License
|
| 89 |
+
[Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0)
|
| 90 |
+
|
| 91 |
+
### Funding
|
| 92 |
+
This work was funded by [Departament de la Vicepresid猫ncia i de Pol铆tiques Digitals i Territori de la Generalitat de Catalunya](https://politiquesdigitals.gencat.cat/ca/inici/index.html#googtrans(ca|en) within the framework of [Projecte AINA](https://politiquesdigitals.gencat.cat/ca/economia/catalonia-ai/aina).
|
| 93 |
+
|
| 94 |
+
### Disclaimer
|
| 95 |
+
|
| 96 |
+
<details>
|
| 97 |
+
<summary>Click to expand</summary>
|
| 98 |
+
|
| 99 |
+
The model published in this repository is intended for a generalist purpose and is available to third parties under a permissive Apache License, Version 2.0.
|
| 100 |
+
|
| 101 |
+
Be aware that the model may have biases and/or any other undesirable distortions.
|
| 102 |
+
|
| 103 |
+
When third parties deploy or provide systems and/or services to other parties using this model (or any system based on it)
|
| 104 |
+
or become users of the model, they should note that it is their responsibility to mitigate the risks arising from its use and,
|
| 105 |
+
in any event, to comply with applicable regulations, including regulations regarding the use of Artificial Intelligence.
|
| 106 |
+
|
| 107 |
+
In no event shall the owner and creator of the model (Barcelona Supercomputing Center)
|
| 108 |
+
be liable for any results arising from the use made by third parties.
|
| 109 |
+
|
| 110 |
+
</details>
|