initial commit
Browse files- README.md +242 -0
- config.json +30 -0
- generation_config.json +6 -0
- handler.py +182 -0
- model-00001-of-00003.safetensors +3 -0
- model-00002-of-00003.safetensors +3 -0
- model-00003-of-00003.safetensors +3 -0
- model.safetensors.index.json +202 -0
- requirements.txt +4 -0
- special_tokens_map.json +16 -0
- tokenizer.json +0 -0
- tokenizer_config.json +12 -0
README.md
ADDED
@@ -0,0 +1,242 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- fr
|
4 |
+
license: cc-by-nc-sa-4.0
|
5 |
+
pipeline_tag: text-generation
|
6 |
+
base_model: tiiuae/falcon-7b
|
7 |
+
tags:
|
8 |
+
- pretrained
|
9 |
+
- conversational
|
10 |
+
widget:
|
11 |
+
- text: |-
|
12 |
+
- Bonjour Dominique, qu'allez-vous nous cuisiner aujourd'hui ?
|
13 |
+
- Bonjour Camille,
|
14 |
+
example_title: Request for a recipe
|
15 |
+
group: Dash
|
16 |
+
- text: |-
|
17 |
+
[Intervenant 1:] Bonjour Dominique, qu'allez-vous nous cuisiner aujourd'hui ?
|
18 |
+
[Intervenant 2:] Bonjour Camille,
|
19 |
+
example_title: Request for a recipe
|
20 |
+
group: Intervenant
|
21 |
+
- text: |-
|
22 |
+
[Camille:] Bonjour Dominique, qu'allez-vous nous cuisiner aujourd'hui ?
|
23 |
+
[Dominique:] Bonjour Camille,
|
24 |
+
example_title: Request for a recipe
|
25 |
+
group: FirstName
|
26 |
+
- text: |-
|
27 |
+
[Camille Durand:] Bonjour Dominique, qu'allez-vous nous cuisiner aujourd'hui ?
|
28 |
+
[Dominique Petit:] Bonjour Camille,
|
29 |
+
example_title: Request for a recipe
|
30 |
+
group: Named
|
31 |
+
inference:
|
32 |
+
parameters:
|
33 |
+
temperature: 1.0
|
34 |
+
max_new_tokens: 200
|
35 |
+
top_k: 10
|
36 |
+
---
|
37 |
+
|
38 |
+
# Claire-7B-0.1
|
39 |
+
|
40 |
+
**Claire-7B-0.1 is a 7B parameter causal decoder-only model built by [LINAGORA](https://labs.linagora.com/) and [OpenLLM-France](https://github.com/OpenLLM-France)**
|
41 |
+
**adapted from [Falcon-7b](https://huggingface.co/tiiuae/falcon-7b) on French conversational data.**
|
42 |
+
|
43 |
+
Quantized versions in GGUF format can be found in [TheBloke/Claire-7B-0.1-GGUF](https://huggingface.co/TheBloke/Claire-7B-0.1-GGUF).
|
44 |
+
|
45 |
+
Claire-7B-0.1 is a pretrained language model designed to be attuned to the dynamics of linguistic interactions in dialogue. Without further training, its expected use is to generate continuations of dialogues. Its main purpose is to serve as a base model for fine-tuning on dialogue generation (e.g., chat) and dialogue understanding (e.g., meeting summarization) tasks. Please note that due to its training, the model is prone to generate dialogues with disfluencies and other constructions common to spoken language.
|
46 |
+
|
47 |
+
* [Typical usage](#typical-usage)
|
48 |
+
* [Typical prompts](#typical-prompts)
|
49 |
+
* [Training Details](#training-details)
|
50 |
+
* [Training Data](#training-data)
|
51 |
+
* [Training Procedure](#training-procedure)
|
52 |
+
* [Evaluation](#evaluation)
|
53 |
+
* [License](#license)
|
54 |
+
* [Acknowledgements](#acknowledgements)
|
55 |
+
* [Contact](#contact)
|
56 |
+
|
57 |
+
|
58 |
+
## Typical usage
|
59 |
+
|
60 |
+
```python
|
61 |
+
import transformers
|
62 |
+
import torch
|
63 |
+
|
64 |
+
model_name = "OpenLLM-France/Claire-7B-0.1"
|
65 |
+
|
66 |
+
tokenizer = transformers.AutoTokenizer.from_pretrained(model_name)
|
67 |
+
model = transformers.AutoModelForCausalLM.from_pretrained(model_name,
|
68 |
+
device_map="auto",
|
69 |
+
torch_dtype=torch.bfloat16,
|
70 |
+
load_in_4bit=True # For efficient inference, if supported by the GPU card
|
71 |
+
)
|
72 |
+
|
73 |
+
pipeline = transformers.pipeline("text-generation", model=model, tokenizer=tokenizer)
|
74 |
+
generation_kwargs = dict(
|
75 |
+
num_return_sequences=1, # Number of variants to generate.
|
76 |
+
return_full_text= False, # Do not include the prompt in the generated text.
|
77 |
+
max_new_tokens=200, # Maximum length for the output text.
|
78 |
+
do_sample=True, top_k=10, temperature=1.0, # Sampling parameters.
|
79 |
+
pad_token_id=tokenizer.eos_token_id, # Just to avoid a harmless warning.
|
80 |
+
)
|
81 |
+
|
82 |
+
prompt = """\
|
83 |
+
- Bonjour Dominique, qu'allez-vous nous cuisiner aujourd'hui ?
|
84 |
+
- Bonjour Camille,\
|
85 |
+
"""
|
86 |
+
completions = pipeline(prompt, **generation_kwargs)
|
87 |
+
for completion in completions:
|
88 |
+
print(prompt + " […]" + completion['generated_text'])
|
89 |
+
```
|
90 |
+
This will print something like:
|
91 |
+
```
|
92 |
+
- Bonjour Dominique, qu'allez-vous nous cuisiner aujourd'hui ?
|
93 |
+
- Bonjour Camille, […] je vous prépare un plat de saison, une daube provençale.
|
94 |
+
- Ah je ne connais pas cette recette.
|
95 |
+
- C'est très facile à préparer, vous n'avez qu'à mettre de l'eau dans une marmite, y mettre de l'oignon émincé, des carottes coupées en petits morceaux, et vous allez mettre votre viande de bœuf coupé en petits morceaux également.
|
96 |
+
- Je n'ai jamais cuisiné de viande de bœuf, mais c'est vrai que ça a l'air bien facile.
|
97 |
+
- Vous n'avez plus qu'à laisser mijoter, et ensuite il sera temps de servir les clients.
|
98 |
+
- Très bien.
|
99 |
+
```
|
100 |
+
|
101 |
+
You will need at least 6GB of VRAM to run inference using 4bit quantization (16GB of VRAM without 4bit quantization).
|
102 |
+
|
103 |
+
If you have trouble running this code, make sure you have recent versions of `torch`, `transformers` and `accelerate` (see [requirements.txt](requirements.txt)).
|
104 |
+
|
105 |
+
### Typical prompts
|
106 |
+
|
107 |
+
Claire-7B-0.1 was trained on diarized French conversations. During training, the dialogues were normalized in several formats. The possible formats for expected prompts are as follows:
|
108 |
+
|
109 |
+
A monologue can be specified as a single line prompt (though keep in mind that Claire might still return a dialogue because of its training):
|
110 |
+
```python
|
111 |
+
prompt = "Mesdames et messieurs les députés, chers collègues, bonsoir. Vous l'aurez peut-être remarqué, je cite rarement"
|
112 |
+
```
|
113 |
+
|
114 |
+
A dialogue between two speakers can be specified with one line per speech turn starting with a dash:
|
115 |
+
```python
|
116 |
+
prompt = """\
|
117 |
+
- Bonjour Dominique, qu'allez-vous nous cuisiner aujourd'hui ?
|
118 |
+
- Bonjour Camille,\
|
119 |
+
"""
|
120 |
+
```
|
121 |
+
|
122 |
+
A dialogue or multilogue (with two or more speakers) can be specified with lines that start with `[Intervenant X:]` where `X` is a number:
|
123 |
+
```python
|
124 |
+
prompt = """\
|
125 |
+
[Intervenant 1:] Bonjour Dominique, qu'allez-vous nous cuisiner aujourd'hui ?
|
126 |
+
[Intervenant 2:] Bonjour Camille,\
|
127 |
+
"""
|
128 |
+
```
|
129 |
+
|
130 |
+
A dialogue or multilogue with named speakers can be specified with lines that start with `[SpeakerName:]`
|
131 |
+
where `SpeakerName` can be a first name, a first and a last name, a nickname, a title…
|
132 |
+
```python
|
133 |
+
prompt = """\
|
134 |
+
[Mme Camille Durand:] Bonjour Dominique, qu'allez-vous nous cuisiner aujourd'hui ?
|
135 |
+
[Mr. Dominique Petit:] Bonjour Camille,\
|
136 |
+
"""
|
137 |
+
```
|
138 |
+
|
139 |
+
## Training Details
|
140 |
+
|
141 |
+
### Training Data
|
142 |
+
|
143 |
+
The training dataset is available at [OpenLLM-France/Claire-Dialogue-French-0.1](https://huggingface.co/datasets/OpenLLM-France/Claire-Dialogue-French-0.1)
|
144 |
+
and described in ["The Claire French Dialogue Dataset" (2023)](https://arxiv.org/abs/2311.16840).
|
145 |
+
|
146 |
+
Claire-7B-0.1 was tuned from Falcon-7b on the following data distribution:
|
147 |
+
|
148 |
+
| **Data type** | **Words** | **Training Sampling Weight** | **Sources** |
|
149 |
+
|-------------------------------|------------|------------------------------|-----------------------------------------------------|
|
150 |
+
| Parliamentary Proceedings | 135M | 35% | Assemblée Nationale |
|
151 |
+
| Theatre | 16M | 18% | Théâtre Classique, Théâtre Gratuit |
|
152 |
+
| Interviews | 6.4M | 29% | TCOF, CFPP, CFPB (ORFEO), ACSYNT, PFC, Valibel (ORFEO), ESLO|
|
153 |
+
| Free Conversations | 2.2M | 10% | CRFP (ORFEO), OFROM (ORFEO), CID, Rhapsodie, ParisStories, PFC, CLAPI, C-ORAL-ROM (ORFEO), LinTO, ESLO |
|
154 |
+
| Meetings | 1.2M | 5% | SUMM-RE, LinTO, Réunions de travail (ORFEO) |
|
155 |
+
| Debates | 402k | <2% | FREDSum, ESLO |
|
156 |
+
| Assistance | 159k | <1% | Fleuron (ORFEO), Accueil UBS, OTG, ESLO |
|
157 |
+
| Presentation, Formal Address | 86k | <0.5% | Valibel (ORFEO), LinTO, ESLO |
|
158 |
+
|
159 |
+
Training data was augmented with the following techniques:
|
160 |
+
* varying the format used to indicate speech turns (dashes or [XXX:])
|
161 |
+
* substituting [Intervenant X:] for [SpeakerName:] or vice versa, where [SpeakerName:] might be a real name or a randomly generated name
|
162 |
+
* removing punctuation marks and/or casing (to prepare the model for transcripts produced by some Automatic Speech Recognition systems)
|
163 |
+
|
164 |
+
Long conversations were truncated at a maximum of 2048 tokens. Where possible, they were split between speaker turns.
|
165 |
+
|
166 |
+
While the model has been trained and evaluated only on French dialogues, it may be able to generate conversations in other languages from the original Falcon-7b training data.
|
167 |
+
|
168 |
+
|
169 |
+
### Training Procedure
|
170 |
+
|
171 |
+
The training code is available at [https://github.com/OpenLLM-France/Lit-Claire](https://github.com/OpenLLM-France/Lit-Claire).
|
172 |
+
|
173 |
+
Claire-7B-0.1 is a causal decoder-only model trained on a causal language modeling task (i.e., predict the next token).
|
174 |
+
See [Falcon-7b](https://huggingface.co/tiiuae/falcon-7b) for more details.
|
175 |
+
|
176 |
+
Claire-7B-0.1 was trained on 1 A100 80GB GPU for about 50 GPU hours.
|
177 |
+
|
178 |
+
Hyperparameters were the following:
|
179 |
+
| **Hyperparameter** | **Value** |
|
180 |
+
|--------------------|------------|
|
181 |
+
| Precision | `bfloat16` |
|
182 |
+
| Optimizer | AdamW |
|
183 |
+
| Learning rate | 1e-4 |
|
184 |
+
| Weight decay | 1e-2 |
|
185 |
+
| Batch size | 132 |
|
186 |
+
| LoRA rank | 16 |
|
187 |
+
| LoRA alpha | 32 |
|
188 |
+
| Dropout | 0.05 |
|
189 |
+
| gradient clipping | 1 |
|
190 |
+
|
191 |
+
## Evaluation
|
192 |
+
|
193 |
+
To evaluate Claire-7B-0.1’s ability to generate natural sounding, French conversations, we compared its responses to a variety of prompts with those of three other models:
|
194 |
+
* [Falcon-7b](https://huggingface.co/tiiuae/falcon-7b),
|
195 |
+
* [Mistral-7B-v0.1](https://huggingface.co/mistralai/Mistral-7B-v0.1)
|
196 |
+
* [Claire-Mistral-7B-0.1](https://huggingface.co/OpenLLM-France/Claire-Mistral-7B-0.1) (a version of Mistral-7B-v0.1 adapted in the same fashion as Claire-7B-0.1)
|
197 |
+
|
198 |
+
We tested an even mixture of monologue and dialogue-style prompts.
|
199 |
+
Each of the four generated responses was evaluated along three dimensions:
|
200 |
+
Interaction, Fluency and Relevance.
|
201 |
+
Evaluators were also asked to rank the four responses by preference.
|
202 |
+
|
203 |
+
Our results confirm that continual pre-training of Falcon-7b and Mistral-7B-v0.1 leads to improvement (relative to the base models) along all three evaluation dimensions and that Claire-7B-0.1 outperforms the adapted Mistral counterpart in the Fluency and Relevance categories
|
204 |
+
(and in the Interaction category if we focus on dialogue-style prompts).
|
205 |
+
|
206 |
+
Ranking results also reveal a clear subjective preference for Claire-7B-0.1,
|
207 |
+
as shown in the following table:
|
208 |
+
<!--| | **Claire-Falcon** | **Claire-Mistral** | **Falcon** | **Mistral** | -->
|
209 |
+
| | <span style="font-weight: normal">... over</span><br /> **Claire-Falcon** | <span style="font-weight: normal">... over</span><br /> **Claire-Mistral** | <span style="font-weight: normal">... over</span><br /> **Falcon** | <span style="font-weight: normal">... over</span><br /> **Mistral** |
|
210 |
+
|--------------------------------------|----------------------|-----------------------|---------------|---------------------|
|
211 |
+
| prefer<br /> **Claire-Falcon** ... | | **62.2%** | **63.9%** | **83.8%** |
|
212 |
+
| prefer<br /> **Claire-Mistral** ... | _34.8%_ | | **56.2%** | **75.3%** |
|
213 |
+
| prefer<br /> **Falcon** ... | _36.1%_ | _43.8%_ | | **81.4%** |
|
214 |
+
| prefer<br /> **Mistral** ... | _16.2%_ | _24.7%_ | _18.6%_ | |
|
215 |
+
|
216 |
+
(In this table,
|
217 |
+
"Claire-Falcon" stands for Claire-7B-0.1,
|
218 |
+
"Falcon", for [Falcon-7b](https://huggingface.co/tiiuae/falcon-7b),
|
219 |
+
"Mistral", for [Mistral-7B-v0.1](https://huggingface.co/mistralai/Mistral-7B-v0.1)
|
220 |
+
and "Claire-Mistral", for [Claire-Mistral-7B-0.1](https://huggingface.co/OpenLLM-France/Claire-Mistral-7B-0.1).)
|
221 |
+
|
222 |
+
Please note that the model can generate disfluencies and humorous responses as a result of its training on spoken and theatrical text.
|
223 |
+
|
224 |
+
|
225 |
+
## License
|
226 |
+
|
227 |
+
Given that some of the corpora used for training are only available under CC-BY-NC-SA licenses,
|
228 |
+
Claire-7B-0.1 is made available under the [CC-BY-NC-SA 4.0 license](https://creativecommons.org/licenses/by-nc-sa/4.0/).
|
229 |
+
|
230 |
+
You can find a variant of this model published under the Apache 2.0 license at [OpenLLM-France/Claire-7B-Apache-0.1](https://huggingface.co/OpenLLM-France/Claire-7B-Apache-0.1).
|
231 |
+
|
232 |
+
## Acknowledgements
|
233 |
+
|
234 |
+
This work was performed using HPC resources from GENCI–IDRIS (Grant 2023-AD011014561).
|
235 |
+
|
236 |
+
Claire-7B-0.1 was created by members of [LINAGORA](https://labs.linagora.com/) (in alphabetical order): Ismaïl Harrando, Julie Hunter, Jean-Pierre Lorré, Jérôme Louradour, Michel-Marie Maudet, Virgile Rennard, Guokan Shang.
|
237 |
+
|
238 |
+
Special thanks to partners from the OpenLLM-France community, especially Christophe Cerisara (LORIA), Pierre-Carl Langlais and Anastasia Stasenko (OpSci), and Pierre Colombo, for valuable advice.
|
239 |
+
|
240 |
+
## Contact
|
241 |
+
|
242 |
+
contact@openllm-france.fr
|
config.json
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "/gpfswork/rech/qgz/uut33um/../commun/Claire/checkpoints/OpenLLM-France/Claire-7B-EN-hf",
|
3 |
+
"alibi": false,
|
4 |
+
"apply_residual_connection_post_layernorm": false,
|
5 |
+
"architectures": [
|
6 |
+
"FalconForCausalLM"
|
7 |
+
],
|
8 |
+
"attention_dropout": 0.0,
|
9 |
+
"bias": false,
|
10 |
+
"bos_token_id": 11,
|
11 |
+
"eos_token_id": 11,
|
12 |
+
"hidden_dropout": 0.0,
|
13 |
+
"hidden_size": 4544,
|
14 |
+
"initializer_range": 0.02,
|
15 |
+
"layer_norm_epsilon": 1e-05,
|
16 |
+
"max_position_embeddings": 2048,
|
17 |
+
"model_type": "falcon",
|
18 |
+
"multi_query": true,
|
19 |
+
"new_decoder_architecture": false,
|
20 |
+
"num_attention_heads": 71,
|
21 |
+
"num_hidden_layers": 32,
|
22 |
+
"num_kv_heads": 71,
|
23 |
+
"parallel_attn": true,
|
24 |
+
"rope_scaling": null,
|
25 |
+
"rope_theta": 10000.0,
|
26 |
+
"torch_dtype": "bfloat16",
|
27 |
+
"transformers_version": "4.36.2",
|
28 |
+
"use_cache": true,
|
29 |
+
"vocab_size": 65024
|
30 |
+
}
|
generation_config.json
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_from_model_config": true,
|
3 |
+
"bos_token_id": 11,
|
4 |
+
"eos_token_id": 11,
|
5 |
+
"transformers_version": "4.36.2"
|
6 |
+
}
|
handler.py
ADDED
@@ -0,0 +1,182 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import torch, transformers
|
2 |
+
from typing import Any, Dict
|
3 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
4 |
+
import re
|
5 |
+
import unicodedata
|
6 |
+
|
7 |
+
|
8 |
+
class EndpointHandler:
|
9 |
+
def __init__(self, path):
|
10 |
+
tokenizer = AutoTokenizer.from_pretrained(path)
|
11 |
+
model = AutoModelForCausalLM.from_pretrained(
|
12 |
+
path, device_map="auto", torch_dtype=torch.bfloat16, load_in_4bit=True
|
13 |
+
)
|
14 |
+
self.pipeline = transformers.pipeline(
|
15 |
+
"text-generation", model=model, tokenizer=tokenizer
|
16 |
+
)
|
17 |
+
|
18 |
+
def __call__(self, data: Dict[str, Any]) -> Dict[str, str]:
|
19 |
+
# process input
|
20 |
+
inputs = data.pop("inputs", data)
|
21 |
+
|
22 |
+
# default parameters
|
23 |
+
parameters = {
|
24 |
+
"max_new_tokens": 128,
|
25 |
+
"do_sample": True,
|
26 |
+
"top_k": 10,
|
27 |
+
"temperature": 1.0,
|
28 |
+
"return_full_text": False,
|
29 |
+
}
|
30 |
+
|
31 |
+
# user parameters
|
32 |
+
parameters.update(data.pop("parameters", {}))
|
33 |
+
|
34 |
+
unique = isinstance(inputs, str)
|
35 |
+
inputs, denormalize_funcs = claire_text_preproc_conversation(inputs)
|
36 |
+
|
37 |
+
sequences = self.pipeline(inputs, **parameters)
|
38 |
+
|
39 |
+
if unique:
|
40 |
+
return [{"generated_text": denormalize_funcs(sequences[0]["generated_text"])}]
|
41 |
+
else:
|
42 |
+
assert len(denormalize_funcs) == len(sequences)
|
43 |
+
return [{"generated_text": denormalize_func(seq[0]["generated_text"])} for denormalize_func, seq in zip(denormalize_funcs, sequences)]
|
44 |
+
|
45 |
+
|
46 |
+
def claire_text_preproc_conversation(text):
|
47 |
+
if isinstance(text, (list, tuple)):
|
48 |
+
assert len(text)
|
49 |
+
# Apply and transpose
|
50 |
+
texts, denormalize_funcs = zip(*[claire_text_preproc_conversation(t) for t in text])
|
51 |
+
return list(texts), list(denormalize_funcs)
|
52 |
+
|
53 |
+
if not isinstance(text, str):
|
54 |
+
return text
|
55 |
+
|
56 |
+
text = format_special_characters(text)
|
57 |
+
|
58 |
+
text = re.sub(" - | -$|^- ", " ", text.strip(" "))
|
59 |
+
|
60 |
+
global _reverse_tag_transfo
|
61 |
+
_reverse_tag_transfo = {}
|
62 |
+
text = format_special_tags(text)
|
63 |
+
|
64 |
+
text = collapse_whitespaces_conversations(text)
|
65 |
+
|
66 |
+
if _reverse_tag_transfo:
|
67 |
+
reverse_tag_transfo = _reverse_tag_transfo.copy()
|
68 |
+
def denormalize_func(t):
|
69 |
+
for k, v in reverse_tag_transfo.items():
|
70 |
+
if k in t:
|
71 |
+
t = t.replace(k, v)
|
72 |
+
return t
|
73 |
+
|
74 |
+
return text, lambda x: denormalize_func(x)
|
75 |
+
|
76 |
+
else:
|
77 |
+
return text, lambda x: x
|
78 |
+
|
79 |
+
|
80 |
+
_brackets = re.compile(r"\[([^\]]*)\]")
|
81 |
+
_pattern_speaker = re.compile(r"[^\]]+:")
|
82 |
+
|
83 |
+
# Global variable to remember some normalizations that were done and apply it back
|
84 |
+
_reverse_tag_transfo = {}
|
85 |
+
_anonymized_prefix = None
|
86 |
+
|
87 |
+
|
88 |
+
def format_special_tags(text):
|
89 |
+
global _reverse_tag_transfo, _anonymized_prefix
|
90 |
+
_anonymized_prefix = None
|
91 |
+
text = re.sub(_brackets, _format_special_tags, text)
|
92 |
+
# At last the generic anonymization
|
93 |
+
if _anonymized_prefix:
|
94 |
+
_reverse_tag_transfo["[Intervenant "] = _anonymized_prefix
|
95 |
+
return text
|
96 |
+
|
97 |
+
|
98 |
+
def _format_special_tags(match):
|
99 |
+
content_within_brackets = match.group(1)
|
100 |
+
if re.match(_pattern_speaker, content_within_brackets):
|
101 |
+
return _format_tag(match.group())
|
102 |
+
else:
|
103 |
+
return ""
|
104 |
+
|
105 |
+
def _format_tag(text):
|
106 |
+
global _reverse_tag_transfo, _anonymized_prefix
|
107 |
+
if text.endswith(":]"):
|
108 |
+
anonymized_spk_prefixes = ["speaker", "spk", "locuteur"]
|
109 |
+
# Conversion "[speaker001:]" -> "[Intervenant 1:]"
|
110 |
+
for prefix in anonymized_spk_prefixes:
|
111 |
+
if text.lower().startswith("["+prefix):
|
112 |
+
try:
|
113 |
+
index = int(text[len(prefix)+1:-2])
|
114 |
+
except ValueError:
|
115 |
+
return text
|
116 |
+
new_spk_tag = f"[Intervenant {index}:]"
|
117 |
+
_reverse_tag_transfo[new_spk_tag] = text
|
118 |
+
if _anonymized_prefix is None:
|
119 |
+
prefix = "["+prefix
|
120 |
+
while len(prefix) < len(text) and text[len(prefix)] in " 0":
|
121 |
+
prefix += text[len(prefix)]
|
122 |
+
_anonymized_prefix = prefix
|
123 |
+
return "\n" + new_spk_tag
|
124 |
+
|
125 |
+
# Capitalize speaker name
|
126 |
+
speaker = text[1:-2]
|
127 |
+
speaker = capitalize(speaker)
|
128 |
+
new_spk_tag = f"[{speaker}:]"
|
129 |
+
if text != new_spk_tag:
|
130 |
+
_reverse_tag_transfo[new_spk_tag] = text
|
131 |
+
return "\n" + new_spk_tag
|
132 |
+
|
133 |
+
# if text == "[PII]":
|
134 |
+
# return "[Nom]"
|
135 |
+
# if text == "[NOISE]":
|
136 |
+
# return "[bruit]"
|
137 |
+
# if text == "[LAUGHTER]":
|
138 |
+
# return "[rire]"
|
139 |
+
|
140 |
+
return ""
|
141 |
+
|
142 |
+
|
143 |
+
def capitalize(text):
|
144 |
+
# Custom capitalization for first and last names
|
145 |
+
words = text.split(" ")
|
146 |
+
words = [w.capitalize() if (not w.isupper() or len(w) > 2) else w for w in words]
|
147 |
+
for i, w in enumerate(words):
|
148 |
+
for sep in "-", "'":
|
149 |
+
if sep in w:
|
150 |
+
words[i] = sep.join(
|
151 |
+
[x.capitalize() if not x.isupper() else x for x in w.split(sep)]
|
152 |
+
)
|
153 |
+
return " ".join(words)
|
154 |
+
|
155 |
+
|
156 |
+
def collapse_whitespaces_conversations(text):
|
157 |
+
text = re.sub(r"\n+", "\n", text)
|
158 |
+
text = re.sub(r"[ \t]+", " ", text)
|
159 |
+
text = re.sub(r"\n ", "\n", text)
|
160 |
+
text = re.sub(r" ([\.,])", r"\1", text)
|
161 |
+
return text.lstrip().rstrip(" ")
|
162 |
+
|
163 |
+
|
164 |
+
def format_special_characters(text):
|
165 |
+
text = unicodedata.normalize("NFC", text)
|
166 |
+
for before, after in [
|
167 |
+
("…", "..."),
|
168 |
+
(r"[«“][^\S\r\n]*", '"'),
|
169 |
+
(r"[^\S\r\n]*[»”″„]", '"'),
|
170 |
+
(r"(``|'')", '"'),
|
171 |
+
(r"[’‘‛ʿ]", "'"),
|
172 |
+
("‚", ","),
|
173 |
+
(r"–", "-"),
|
174 |
+
("[ ]", " "), # unbreakable spaces
|
175 |
+
(r"[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x9F]", ""), # non-printable characters
|
176 |
+
# ("·", "."),
|
177 |
+
(r"ᵉʳ", "er"),
|
178 |
+
(r"ᵉ", "e"),
|
179 |
+
]:
|
180 |
+
text = re.sub(before, after, text)
|
181 |
+
|
182 |
+
return text
|
model-00001-of-00003.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5fdce82e6c69bd8c691949a14ced1ce830b0379e07d2b430f8a3b2515b7cd317
|
3 |
+
size 4981285848
|
model-00002-of-00003.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:67532d97e6c33c83d519f04321c0181a32a1c6f8df0cdf297c35b23b24ab3d1a
|
3 |
+
size 4969690568
|
model-00003-of-00003.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:39e5a744fb06d62cb9f792ae1c3031174e3e23d22f08bcb8750a1e14ef4d2d85
|
3 |
+
size 3892488296
|
model.safetensors.index.json
ADDED
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"metadata": {
|
3 |
+
"total_size": 13843441408
|
4 |
+
},
|
5 |
+
"weight_map": {
|
6 |
+
"transformer.h.0.input_layernorm.bias": "model-00001-of-00003.safetensors",
|
7 |
+
"transformer.h.0.input_layernorm.weight": "model-00001-of-00003.safetensors",
|
8 |
+
"transformer.h.0.mlp.dense_4h_to_h.weight": "model-00001-of-00003.safetensors",
|
9 |
+
"transformer.h.0.mlp.dense_h_to_4h.weight": "model-00001-of-00003.safetensors",
|
10 |
+
"transformer.h.0.self_attention.dense.weight": "model-00001-of-00003.safetensors",
|
11 |
+
"transformer.h.0.self_attention.query_key_value.weight": "model-00001-of-00003.safetensors",
|
12 |
+
"transformer.h.1.input_layernorm.bias": "model-00001-of-00003.safetensors",
|
13 |
+
"transformer.h.1.input_layernorm.weight": "model-00001-of-00003.safetensors",
|
14 |
+
"transformer.h.1.mlp.dense_4h_to_h.weight": "model-00001-of-00003.safetensors",
|
15 |
+
"transformer.h.1.mlp.dense_h_to_4h.weight": "model-00001-of-00003.safetensors",
|
16 |
+
"transformer.h.1.self_attention.dense.weight": "model-00001-of-00003.safetensors",
|
17 |
+
"transformer.h.1.self_attention.query_key_value.weight": "model-00001-of-00003.safetensors",
|
18 |
+
"transformer.h.10.input_layernorm.bias": "model-00002-of-00003.safetensors",
|
19 |
+
"transformer.h.10.input_layernorm.weight": "model-00002-of-00003.safetensors",
|
20 |
+
"transformer.h.10.mlp.dense_4h_to_h.weight": "model-00002-of-00003.safetensors",
|
21 |
+
"transformer.h.10.mlp.dense_h_to_4h.weight": "model-00001-of-00003.safetensors",
|
22 |
+
"transformer.h.10.self_attention.dense.weight": "model-00001-of-00003.safetensors",
|
23 |
+
"transformer.h.10.self_attention.query_key_value.weight": "model-00001-of-00003.safetensors",
|
24 |
+
"transformer.h.11.input_layernorm.bias": "model-00002-of-00003.safetensors",
|
25 |
+
"transformer.h.11.input_layernorm.weight": "model-00002-of-00003.safetensors",
|
26 |
+
"transformer.h.11.mlp.dense_4h_to_h.weight": "model-00002-of-00003.safetensors",
|
27 |
+
"transformer.h.11.mlp.dense_h_to_4h.weight": "model-00002-of-00003.safetensors",
|
28 |
+
"transformer.h.11.self_attention.dense.weight": "model-00002-of-00003.safetensors",
|
29 |
+
"transformer.h.11.self_attention.query_key_value.weight": "model-00002-of-00003.safetensors",
|
30 |
+
"transformer.h.12.input_layernorm.bias": "model-00002-of-00003.safetensors",
|
31 |
+
"transformer.h.12.input_layernorm.weight": "model-00002-of-00003.safetensors",
|
32 |
+
"transformer.h.12.mlp.dense_4h_to_h.weight": "model-00002-of-00003.safetensors",
|
33 |
+
"transformer.h.12.mlp.dense_h_to_4h.weight": "model-00002-of-00003.safetensors",
|
34 |
+
"transformer.h.12.self_attention.dense.weight": "model-00002-of-00003.safetensors",
|
35 |
+
"transformer.h.12.self_attention.query_key_value.weight": "model-00002-of-00003.safetensors",
|
36 |
+
"transformer.h.13.input_layernorm.bias": "model-00002-of-00003.safetensors",
|
37 |
+
"transformer.h.13.input_layernorm.weight": "model-00002-of-00003.safetensors",
|
38 |
+
"transformer.h.13.mlp.dense_4h_to_h.weight": "model-00002-of-00003.safetensors",
|
39 |
+
"transformer.h.13.mlp.dense_h_to_4h.weight": "model-00002-of-00003.safetensors",
|
40 |
+
"transformer.h.13.self_attention.dense.weight": "model-00002-of-00003.safetensors",
|
41 |
+
"transformer.h.13.self_attention.query_key_value.weight": "model-00002-of-00003.safetensors",
|
42 |
+
"transformer.h.14.input_layernorm.bias": "model-00002-of-00003.safetensors",
|
43 |
+
"transformer.h.14.input_layernorm.weight": "model-00002-of-00003.safetensors",
|
44 |
+
"transformer.h.14.mlp.dense_4h_to_h.weight": "model-00002-of-00003.safetensors",
|
45 |
+
"transformer.h.14.mlp.dense_h_to_4h.weight": "model-00002-of-00003.safetensors",
|
46 |
+
"transformer.h.14.self_attention.dense.weight": "model-00002-of-00003.safetensors",
|
47 |
+
"transformer.h.14.self_attention.query_key_value.weight": "model-00002-of-00003.safetensors",
|
48 |
+
"transformer.h.15.input_layernorm.bias": "model-00002-of-00003.safetensors",
|
49 |
+
"transformer.h.15.input_layernorm.weight": "model-00002-of-00003.safetensors",
|
50 |
+
"transformer.h.15.mlp.dense_4h_to_h.weight": "model-00002-of-00003.safetensors",
|
51 |
+
"transformer.h.15.mlp.dense_h_to_4h.weight": "model-00002-of-00003.safetensors",
|
52 |
+
"transformer.h.15.self_attention.dense.weight": "model-00002-of-00003.safetensors",
|
53 |
+
"transformer.h.15.self_attention.query_key_value.weight": "model-00002-of-00003.safetensors",
|
54 |
+
"transformer.h.16.input_layernorm.bias": "model-00002-of-00003.safetensors",
|
55 |
+
"transformer.h.16.input_layernorm.weight": "model-00002-of-00003.safetensors",
|
56 |
+
"transformer.h.16.mlp.dense_4h_to_h.weight": "model-00002-of-00003.safetensors",
|
57 |
+
"transformer.h.16.mlp.dense_h_to_4h.weight": "model-00002-of-00003.safetensors",
|
58 |
+
"transformer.h.16.self_attention.dense.weight": "model-00002-of-00003.safetensors",
|
59 |
+
"transformer.h.16.self_attention.query_key_value.weight": "model-00002-of-00003.safetensors",
|
60 |
+
"transformer.h.17.input_layernorm.bias": "model-00002-of-00003.safetensors",
|
61 |
+
"transformer.h.17.input_layernorm.weight": "model-00002-of-00003.safetensors",
|
62 |
+
"transformer.h.17.mlp.dense_4h_to_h.weight": "model-00002-of-00003.safetensors",
|
63 |
+
"transformer.h.17.mlp.dense_h_to_4h.weight": "model-00002-of-00003.safetensors",
|
64 |
+
"transformer.h.17.self_attention.dense.weight": "model-00002-of-00003.safetensors",
|
65 |
+
"transformer.h.17.self_attention.query_key_value.weight": "model-00002-of-00003.safetensors",
|
66 |
+
"transformer.h.18.input_layernorm.bias": "model-00002-of-00003.safetensors",
|
67 |
+
"transformer.h.18.input_layernorm.weight": "model-00002-of-00003.safetensors",
|
68 |
+
"transformer.h.18.mlp.dense_4h_to_h.weight": "model-00002-of-00003.safetensors",
|
69 |
+
"transformer.h.18.mlp.dense_h_to_4h.weight": "model-00002-of-00003.safetensors",
|
70 |
+
"transformer.h.18.self_attention.dense.weight": "model-00002-of-00003.safetensors",
|
71 |
+
"transformer.h.18.self_attention.query_key_value.weight": "model-00002-of-00003.safetensors",
|
72 |
+
"transformer.h.19.input_layernorm.bias": "model-00002-of-00003.safetensors",
|
73 |
+
"transformer.h.19.input_layernorm.weight": "model-00002-of-00003.safetensors",
|
74 |
+
"transformer.h.19.mlp.dense_4h_to_h.weight": "model-00002-of-00003.safetensors",
|
75 |
+
"transformer.h.19.mlp.dense_h_to_4h.weight": "model-00002-of-00003.safetensors",
|
76 |
+
"transformer.h.19.self_attention.dense.weight": "model-00002-of-00003.safetensors",
|
77 |
+
"transformer.h.19.self_attention.query_key_value.weight": "model-00002-of-00003.safetensors",
|
78 |
+
"transformer.h.2.input_layernorm.bias": "model-00001-of-00003.safetensors",
|
79 |
+
"transformer.h.2.input_layernorm.weight": "model-00001-of-00003.safetensors",
|
80 |
+
"transformer.h.2.mlp.dense_4h_to_h.weight": "model-00001-of-00003.safetensors",
|
81 |
+
"transformer.h.2.mlp.dense_h_to_4h.weight": "model-00001-of-00003.safetensors",
|
82 |
+
"transformer.h.2.self_attention.dense.weight": "model-00001-of-00003.safetensors",
|
83 |
+
"transformer.h.2.self_attention.query_key_value.weight": "model-00001-of-00003.safetensors",
|
84 |
+
"transformer.h.20.input_layernorm.bias": "model-00002-of-00003.safetensors",
|
85 |
+
"transformer.h.20.input_layernorm.weight": "model-00002-of-00003.safetensors",
|
86 |
+
"transformer.h.20.mlp.dense_4h_to_h.weight": "model-00002-of-00003.safetensors",
|
87 |
+
"transformer.h.20.mlp.dense_h_to_4h.weight": "model-00002-of-00003.safetensors",
|
88 |
+
"transformer.h.20.self_attention.dense.weight": "model-00002-of-00003.safetensors",
|
89 |
+
"transformer.h.20.self_attention.query_key_value.weight": "model-00002-of-00003.safetensors",
|
90 |
+
"transformer.h.21.input_layernorm.bias": "model-00002-of-00003.safetensors",
|
91 |
+
"transformer.h.21.input_layernorm.weight": "model-00002-of-00003.safetensors",
|
92 |
+
"transformer.h.21.mlp.dense_4h_to_h.weight": "model-00002-of-00003.safetensors",
|
93 |
+
"transformer.h.21.mlp.dense_h_to_4h.weight": "model-00002-of-00003.safetensors",
|
94 |
+
"transformer.h.21.self_attention.dense.weight": "model-00002-of-00003.safetensors",
|
95 |
+
"transformer.h.21.self_attention.query_key_value.weight": "model-00002-of-00003.safetensors",
|
96 |
+
"transformer.h.22.input_layernorm.bias": "model-00003-of-00003.safetensors",
|
97 |
+
"transformer.h.22.input_layernorm.weight": "model-00003-of-00003.safetensors",
|
98 |
+
"transformer.h.22.mlp.dense_4h_to_h.weight": "model-00003-of-00003.safetensors",
|
99 |
+
"transformer.h.22.mlp.dense_h_to_4h.weight": "model-00002-of-00003.safetensors",
|
100 |
+
"transformer.h.22.self_attention.dense.weight": "model-00002-of-00003.safetensors",
|
101 |
+
"transformer.h.22.self_attention.query_key_value.weight": "model-00002-of-00003.safetensors",
|
102 |
+
"transformer.h.23.input_layernorm.bias": "model-00003-of-00003.safetensors",
|
103 |
+
"transformer.h.23.input_layernorm.weight": "model-00003-of-00003.safetensors",
|
104 |
+
"transformer.h.23.mlp.dense_4h_to_h.weight": "model-00003-of-00003.safetensors",
|
105 |
+
"transformer.h.23.mlp.dense_h_to_4h.weight": "model-00003-of-00003.safetensors",
|
106 |
+
"transformer.h.23.self_attention.dense.weight": "model-00003-of-00003.safetensors",
|
107 |
+
"transformer.h.23.self_attention.query_key_value.weight": "model-00003-of-00003.safetensors",
|
108 |
+
"transformer.h.24.input_layernorm.bias": "model-00003-of-00003.safetensors",
|
109 |
+
"transformer.h.24.input_layernorm.weight": "model-00003-of-00003.safetensors",
|
110 |
+
"transformer.h.24.mlp.dense_4h_to_h.weight": "model-00003-of-00003.safetensors",
|
111 |
+
"transformer.h.24.mlp.dense_h_to_4h.weight": "model-00003-of-00003.safetensors",
|
112 |
+
"transformer.h.24.self_attention.dense.weight": "model-00003-of-00003.safetensors",
|
113 |
+
"transformer.h.24.self_attention.query_key_value.weight": "model-00003-of-00003.safetensors",
|
114 |
+
"transformer.h.25.input_layernorm.bias": "model-00003-of-00003.safetensors",
|
115 |
+
"transformer.h.25.input_layernorm.weight": "model-00003-of-00003.safetensors",
|
116 |
+
"transformer.h.25.mlp.dense_4h_to_h.weight": "model-00003-of-00003.safetensors",
|
117 |
+
"transformer.h.25.mlp.dense_h_to_4h.weight": "model-00003-of-00003.safetensors",
|
118 |
+
"transformer.h.25.self_attention.dense.weight": "model-00003-of-00003.safetensors",
|
119 |
+
"transformer.h.25.self_attention.query_key_value.weight": "model-00003-of-00003.safetensors",
|
120 |
+
"transformer.h.26.input_layernorm.bias": "model-00003-of-00003.safetensors",
|
121 |
+
"transformer.h.26.input_layernorm.weight": "model-00003-of-00003.safetensors",
|
122 |
+
"transformer.h.26.mlp.dense_4h_to_h.weight": "model-00003-of-00003.safetensors",
|
123 |
+
"transformer.h.26.mlp.dense_h_to_4h.weight": "model-00003-of-00003.safetensors",
|
124 |
+
"transformer.h.26.self_attention.dense.weight": "model-00003-of-00003.safetensors",
|
125 |
+
"transformer.h.26.self_attention.query_key_value.weight": "model-00003-of-00003.safetensors",
|
126 |
+
"transformer.h.27.input_layernorm.bias": "model-00003-of-00003.safetensors",
|
127 |
+
"transformer.h.27.input_layernorm.weight": "model-00003-of-00003.safetensors",
|
128 |
+
"transformer.h.27.mlp.dense_4h_to_h.weight": "model-00003-of-00003.safetensors",
|
129 |
+
"transformer.h.27.mlp.dense_h_to_4h.weight": "model-00003-of-00003.safetensors",
|
130 |
+
"transformer.h.27.self_attention.dense.weight": "model-00003-of-00003.safetensors",
|
131 |
+
"transformer.h.27.self_attention.query_key_value.weight": "model-00003-of-00003.safetensors",
|
132 |
+
"transformer.h.28.input_layernorm.bias": "model-00003-of-00003.safetensors",
|
133 |
+
"transformer.h.28.input_layernorm.weight": "model-00003-of-00003.safetensors",
|
134 |
+
"transformer.h.28.mlp.dense_4h_to_h.weight": "model-00003-of-00003.safetensors",
|
135 |
+
"transformer.h.28.mlp.dense_h_to_4h.weight": "model-00003-of-00003.safetensors",
|
136 |
+
"transformer.h.28.self_attention.dense.weight": "model-00003-of-00003.safetensors",
|
137 |
+
"transformer.h.28.self_attention.query_key_value.weight": "model-00003-of-00003.safetensors",
|
138 |
+
"transformer.h.29.input_layernorm.bias": "model-00003-of-00003.safetensors",
|
139 |
+
"transformer.h.29.input_layernorm.weight": "model-00003-of-00003.safetensors",
|
140 |
+
"transformer.h.29.mlp.dense_4h_to_h.weight": "model-00003-of-00003.safetensors",
|
141 |
+
"transformer.h.29.mlp.dense_h_to_4h.weight": "model-00003-of-00003.safetensors",
|
142 |
+
"transformer.h.29.self_attention.dense.weight": "model-00003-of-00003.safetensors",
|
143 |
+
"transformer.h.29.self_attention.query_key_value.weight": "model-00003-of-00003.safetensors",
|
144 |
+
"transformer.h.3.input_layernorm.bias": "model-00001-of-00003.safetensors",
|
145 |
+
"transformer.h.3.input_layernorm.weight": "model-00001-of-00003.safetensors",
|
146 |
+
"transformer.h.3.mlp.dense_4h_to_h.weight": "model-00001-of-00003.safetensors",
|
147 |
+
"transformer.h.3.mlp.dense_h_to_4h.weight": "model-00001-of-00003.safetensors",
|
148 |
+
"transformer.h.3.self_attention.dense.weight": "model-00001-of-00003.safetensors",
|
149 |
+
"transformer.h.3.self_attention.query_key_value.weight": "model-00001-of-00003.safetensors",
|
150 |
+
"transformer.h.30.input_layernorm.bias": "model-00003-of-00003.safetensors",
|
151 |
+
"transformer.h.30.input_layernorm.weight": "model-00003-of-00003.safetensors",
|
152 |
+
"transformer.h.30.mlp.dense_4h_to_h.weight": "model-00003-of-00003.safetensors",
|
153 |
+
"transformer.h.30.mlp.dense_h_to_4h.weight": "model-00003-of-00003.safetensors",
|
154 |
+
"transformer.h.30.self_attention.dense.weight": "model-00003-of-00003.safetensors",
|
155 |
+
"transformer.h.30.self_attention.query_key_value.weight": "model-00003-of-00003.safetensors",
|
156 |
+
"transformer.h.31.input_layernorm.bias": "model-00003-of-00003.safetensors",
|
157 |
+
"transformer.h.31.input_layernorm.weight": "model-00003-of-00003.safetensors",
|
158 |
+
"transformer.h.31.mlp.dense_4h_to_h.weight": "model-00003-of-00003.safetensors",
|
159 |
+
"transformer.h.31.mlp.dense_h_to_4h.weight": "model-00003-of-00003.safetensors",
|
160 |
+
"transformer.h.31.self_attention.dense.weight": "model-00003-of-00003.safetensors",
|
161 |
+
"transformer.h.31.self_attention.query_key_value.weight": "model-00003-of-00003.safetensors",
|
162 |
+
"transformer.h.4.input_layernorm.bias": "model-00001-of-00003.safetensors",
|
163 |
+
"transformer.h.4.input_layernorm.weight": "model-00001-of-00003.safetensors",
|
164 |
+
"transformer.h.4.mlp.dense_4h_to_h.weight": "model-00001-of-00003.safetensors",
|
165 |
+
"transformer.h.4.mlp.dense_h_to_4h.weight": "model-00001-of-00003.safetensors",
|
166 |
+
"transformer.h.4.self_attention.dense.weight": "model-00001-of-00003.safetensors",
|
167 |
+
"transformer.h.4.self_attention.query_key_value.weight": "model-00001-of-00003.safetensors",
|
168 |
+
"transformer.h.5.input_layernorm.bias": "model-00001-of-00003.safetensors",
|
169 |
+
"transformer.h.5.input_layernorm.weight": "model-00001-of-00003.safetensors",
|
170 |
+
"transformer.h.5.mlp.dense_4h_to_h.weight": "model-00001-of-00003.safetensors",
|
171 |
+
"transformer.h.5.mlp.dense_h_to_4h.weight": "model-00001-of-00003.safetensors",
|
172 |
+
"transformer.h.5.self_attention.dense.weight": "model-00001-of-00003.safetensors",
|
173 |
+
"transformer.h.5.self_attention.query_key_value.weight": "model-00001-of-00003.safetensors",
|
174 |
+
"transformer.h.6.input_layernorm.bias": "model-00001-of-00003.safetensors",
|
175 |
+
"transformer.h.6.input_layernorm.weight": "model-00001-of-00003.safetensors",
|
176 |
+
"transformer.h.6.mlp.dense_4h_to_h.weight": "model-00001-of-00003.safetensors",
|
177 |
+
"transformer.h.6.mlp.dense_h_to_4h.weight": "model-00001-of-00003.safetensors",
|
178 |
+
"transformer.h.6.self_attention.dense.weight": "model-00001-of-00003.safetensors",
|
179 |
+
"transformer.h.6.self_attention.query_key_value.weight": "model-00001-of-00003.safetensors",
|
180 |
+
"transformer.h.7.input_layernorm.bias": "model-00001-of-00003.safetensors",
|
181 |
+
"transformer.h.7.input_layernorm.weight": "model-00001-of-00003.safetensors",
|
182 |
+
"transformer.h.7.mlp.dense_4h_to_h.weight": "model-00001-of-00003.safetensors",
|
183 |
+
"transformer.h.7.mlp.dense_h_to_4h.weight": "model-00001-of-00003.safetensors",
|
184 |
+
"transformer.h.7.self_attention.dense.weight": "model-00001-of-00003.safetensors",
|
185 |
+
"transformer.h.7.self_attention.query_key_value.weight": "model-00001-of-00003.safetensors",
|
186 |
+
"transformer.h.8.input_layernorm.bias": "model-00001-of-00003.safetensors",
|
187 |
+
"transformer.h.8.input_layernorm.weight": "model-00001-of-00003.safetensors",
|
188 |
+
"transformer.h.8.mlp.dense_4h_to_h.weight": "model-00001-of-00003.safetensors",
|
189 |
+
"transformer.h.8.mlp.dense_h_to_4h.weight": "model-00001-of-00003.safetensors",
|
190 |
+
"transformer.h.8.self_attention.dense.weight": "model-00001-of-00003.safetensors",
|
191 |
+
"transformer.h.8.self_attention.query_key_value.weight": "model-00001-of-00003.safetensors",
|
192 |
+
"transformer.h.9.input_layernorm.bias": "model-00001-of-00003.safetensors",
|
193 |
+
"transformer.h.9.input_layernorm.weight": "model-00001-of-00003.safetensors",
|
194 |
+
"transformer.h.9.mlp.dense_4h_to_h.weight": "model-00001-of-00003.safetensors",
|
195 |
+
"transformer.h.9.mlp.dense_h_to_4h.weight": "model-00001-of-00003.safetensors",
|
196 |
+
"transformer.h.9.self_attention.dense.weight": "model-00001-of-00003.safetensors",
|
197 |
+
"transformer.h.9.self_attention.query_key_value.weight": "model-00001-of-00003.safetensors",
|
198 |
+
"transformer.ln_f.bias": "model-00003-of-00003.safetensors",
|
199 |
+
"transformer.ln_f.weight": "model-00003-of-00003.safetensors",
|
200 |
+
"transformer.word_embeddings.weight": "model-00001-of-00003.safetensors"
|
201 |
+
}
|
202 |
+
}
|
requirements.txt
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
transformers>=4.34.0
|
2 |
+
accelerate>=0.20.3
|
3 |
+
bitsandbytes
|
4 |
+
einops
|
special_tokens_map.json
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"additional_special_tokens": [
|
3 |
+
">>TITLE<<",
|
4 |
+
">>ABSTRACT<<",
|
5 |
+
">>INTRODUCTION<<",
|
6 |
+
">>SUMMARY<<",
|
7 |
+
">>COMMENT<<",
|
8 |
+
">>ANSWER<<",
|
9 |
+
">>QUESTION<<",
|
10 |
+
">>DOMAIN<<",
|
11 |
+
">>PREFIX<<",
|
12 |
+
">>SUFFIX<<",
|
13 |
+
">>MIDDLE<<"
|
14 |
+
],
|
15 |
+
"eos_token": "<|endoftext|>"
|
16 |
+
}
|
tokenizer.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
tokenizer_config.json
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"add_prefix_space": false,
|
3 |
+
"eos_token": "<|endoftext|>",
|
4 |
+
"model_input_names": [
|
5 |
+
"input_ids",
|
6 |
+
"attention_mask"
|
7 |
+
],
|
8 |
+
"model_max_length": 2048,
|
9 |
+
"name_or_path": "tiiuae/falcon_tokenizer",
|
10 |
+
"special_tokens_map_file": null,
|
11 |
+
"tokenizer_class": "PreTrainedTokenizerFast"
|
12 |
+
}
|