初始化项目,由ModelHub XC社区提供模型

Model: proxectonos/Carballo-bloom-1.3B
Source: Original Platform
This commit is contained in:
ModelHub XC
2026-04-27 08:39:56 +08:00
commit 5b9d72fce4
9 changed files with 150670 additions and 0 deletions

35
.gitattributes vendored Normal file
View File

@@ -0,0 +1,35 @@
*.7z filter=lfs diff=lfs merge=lfs -text
*.arrow filter=lfs diff=lfs merge=lfs -text
*.bin filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.ckpt filter=lfs diff=lfs merge=lfs -text
*.ftz filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.h5 filter=lfs diff=lfs merge=lfs -text
*.joblib filter=lfs diff=lfs merge=lfs -text
*.lfs.* filter=lfs diff=lfs merge=lfs -text
*.mlmodel filter=lfs diff=lfs merge=lfs -text
*.model filter=lfs diff=lfs merge=lfs -text
*.msgpack filter=lfs diff=lfs merge=lfs -text
*.npy filter=lfs diff=lfs merge=lfs -text
*.npz filter=lfs diff=lfs merge=lfs -text
*.onnx filter=lfs diff=lfs merge=lfs -text
*.ot filter=lfs diff=lfs merge=lfs -text
*.parquet filter=lfs diff=lfs merge=lfs -text
*.pb filter=lfs diff=lfs merge=lfs -text
*.pickle filter=lfs diff=lfs merge=lfs -text
*.pkl filter=lfs diff=lfs merge=lfs -text
*.pt filter=lfs diff=lfs merge=lfs -text
*.pth filter=lfs diff=lfs merge=lfs -text
*.rar filter=lfs diff=lfs merge=lfs -text
*.safetensors filter=lfs diff=lfs merge=lfs -text
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
*.tar.* filter=lfs diff=lfs merge=lfs -text
*.tar filter=lfs diff=lfs merge=lfs -text
*.tflite filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.wasm filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text
*tfevents* filter=lfs diff=lfs merge=lfs -text

235
README.md Normal file
View File

@@ -0,0 +1,235 @@
---
language:
- gl
tags:
- galician
- FLOR
- bloom
license: apache-2.0
inference:
parameters:
top_k: 10
do_sample: true
temperature: 0.4
widget:
- text: |-
Traduce ao galego esta frase en inglés:
Inglés: "my sister is studying Biology at the university."
Galego: "a miña irmá está a estudar bioloxía na universidade."
----
Traduce ao galego esta frase en inglés:
Inglés: "You are working with my mother on a very interesting project."
Galego: "Estás a traballar coa miña nai nun proxecto moi interesante"
----
Traduce ao galego esta frase en inglés:
Inglés: "You have to fix the computer now"
Galego:
example_title: Translation
- text: |-
Responde á seguinte pregunta.
Pregunta: "Cal é a capital de Noruega?"
Resposta: "A capital de Noruega é Oslo."
----
Responde á seguinte pregunta.
Pregunta: "Cal é a moeda de Portugal"
Resposta: "A moeda de Portugal é o euro."
----
Responde á seguinte pregunta.
Pregunta: "Cal é a capital de Suecia?"
Resposta:
example_title: Question&Answering
- text: |-
Cualifica como Positivo ou Negativo o sentimento da seguinte frase:
Texto: "Estou moi feliz"
Polaridade: Positivo
----
Cualifica como Positivo ou Negativo o sentimento da seguinte frase:
Texto: "Non me gusta beber cervexa"
Polaridade: Negativo
----
Cualifica como Positivo ou Negativo o sentimento da seguinte frase:
Texto: "O meu pai detesta o seu traballo"
Polaridade: Negativo
----
Cualifica como Positivo ou Negativo o sentimento da seguinte frase:
Texto: "Uxía desfruta xogando ao fútbol"
Polaridade: Positivo
----
Cualifica como Positivo ou Negativo o sentimento da seguinte frase:
Texto: "O neno non está contento coas notas"
Polaridade:
example_title: Sentiment Analysis
- text: |-
Extrae as entidades nomeadas do seguinte texto:
Texto: "Chámome Wolfgang e vivo en Berlin"
Entidades: Wolfgang:PER, Berlin:LOC
----
Extrae as entidades nomeadas do seguinte texto:
Texto: "María e Miguel non teñen ningún problema"
Entidades: María:PER, Miguel:PER
----
Extrae as entidades nomeadas do seguinte texto:
Texto: "O mellor de Barcelona é o bar do meu amigo Pablo"
Entidades: Pablo:PER, Barcelona:LOC
----
Extrae as entidades nomeadas do seguinte texto:
Texto: "Carlos comparte cuarto con Marc"
Entidades:
example_title: Name Entity Recognition (NER)
- text: A receita tradicional das filloas é
example_title: Filloas
- text: O neno vivía preto de
example_title: O neno
datasets:
- proxectonos/corpusnos
---
# Carballo-bloom-1.3B
## Table of Contents
<details>
<summary>Click to expand</summary>
- [Carballo-bloom-1.3B](#carballo-bloom-13)
- [Table of Contents](#table-of-contents)
- [Model description](#model-description)
- [Intended uses and limitations](#intended-uses-and-limitations)
- [How to use](#how-to-use)
- [Training](#training)
- [Tools](#tools)
- [Language adaptation and training](#language-adaptation-and-training)
- [Training data](#training-data)
- [Training hyperparameters](#training-hyperparameters)
- [Framework](#framework)
- [Evaluation](#evaluation)
- [Additional information](#additional-information)
- [Contact](#contact)
- [Copyright](#copyright)
- [License](#license)
- [Funding](#funding)
- [Citation information](#citation-information)
</details>
## Model description
**Carballo-bloom-1.3B** is a 1.3B-parameter transformer-based causal language model for Galician.
It is the result of a continual pretraining of [FLOR-1.3B](https://huggingface.co/projecte-aina/FLOR-1.3B) (developed by [AINA Project](https://projecteaina.cat/) and based in [BLOOM-1.7B](https://huggingface.co/bigscience/bloom-1b7)) with the galician corpus [CorpusNos](https://zenodo.org/records/10687642).
## Intended uses and limitations
The **Carballo-bloom-1.3B** model is ready-to-use only for causal language modeling.
It can perform text-generation tasks and be fine-tuned for specific scenarios.
## How to use
```python
import torch
from transformers import pipeline, AutoTokenizer, AutoModelForCausalLM
input_text = "Hoxe fai un bo día. O sol "
model_id = "proxectonos/Carballo-bloom-1.3B"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id)
generator = pipeline(
"text-generation",
model=model,
tokenizer=tokenizer,
torch_dtype=torch.bfloat16,
trust_remote_code=True,
device_map="auto",
)
generation = generator(
input_text,
do_sample=True,
top_k=10,
eos_token_id=tokenizer.eos_token_id
)
print(f"Result: {generation[0]['generated_text']}")
```
## Training
### Tools
It was trained using HuggingFace Transformers and Pytorch, using the [Causal Modeling Language script](https://github.com/huggingface/transformers/blob/main/examples/pytorch/language-modeling/run_clm.py)
### Language adaptation and training
The language adaptation technique used to train Carballo-bloom-1.3B is based in the used to train FLOR-1.3B, which is explained by their authors in this [Medium Post](https://medium.com/@mpamies247/flor-6-3b-a-chinchilla-compliant-model-for-catalan-spanish-and-english-7cdb389a9aac). In summary, we proceeded as follows:
1) We trained our own BPE tokenizer for galician and replaced the original FLOR-1.3B tokenizer and vocabulary with it.
2) The embeddings corresponding to tokens that are present in both the original and the target vocabulary (matching tokens) were used for initialization.
3) The embeddings from tokens not present in Carballo-bloom-1.3B's original vocabulary were initialized as the average of all embeddings.
4) The model was initialized with the weights from FLOR-1.3B and with our adapted tokenizer (step 1) and embeddings (steps 2-3).
5) The model was then trained on a galician corpus.
### Training data
[CorpusNÓS](https://zenodo.org/records/10687642 ) is a massive Galician corpus made up of 2.1B words primarily devised for training large language models. The corpus sources are varied and represent a relatively wide range of genres.
The corpus is structured as follows:
| Subcorpus | Genre | Nº tokens | Nº documents |
|---------------------------------------|---------------------|----------------|--------------|
| Data obtained via transfer agreement | Books | 7,255,784 | 104 |
| | Research articles | 2,665,351 | 664 |
| | Press | 124,253,084 | 224,419 |
| | Governmental | 245,897,880 | 654,505 |
| | Web contents | 15,946,686 | 44,165 |
| | Encyclopedic | 4,799,214 | 47,396 |
| | Subtotal | 400,817,999 | 971,253 |
| Subcorpus | Genre | Nº tokens | Nº documents |
|---------------------------------------|---------------------|----------------|--------------|
| Public data | Press and blogs | 153,497,883 | 665,265 |
| | Encyclopedic | 57,164,848 | 184,628 |
| | Web crawls | 1,384,015,664 | 3,366,449 |
| | Translation corpora | 133,726,004 | 4,745,799 |
| | Subtotal | 1,728,404,399 | 8,777,514 |
| | Total | 2,129,222,398 | 9,748,767 |
| Download (Zenodo) | https://zenodo.org/records/10687642 |
### Training hyperparameters
- seed: 42
- num_devices: 1
- train_batch_size: 2
- eval_batch_size: 2
- gradient_acummulation: 4
- optimizer: AdamW
- betas: (0.9,0.999)
- epsilon: 1e-08
- weight_decay_rate: 0.1
- scheduler: "Linear"
- learning_rate: 5e-05
- num_epochs: 1.2
### Framework
The traininf was conducted in the Galicia Supercomputing Center ([CESGA](https://www.cesga.es/en/home-2/)), using 1 node with 5 GPUs NVIDIA A100.
## Evaluation
| **Model** | **Belebele** | **CoLA** | **OpenBookQA** | **Parafrases-gl** | **PAWS-X** |
|-------------|------------------|----------------|----------------|----------------|----------------|
| *Carballo-Bloom* | 0.231±0.014 | 0.499±0.012 | 0.364±0.022 | 0.523±0.031 | **0.541±0.011** |
| *Carballo-Cerebras* | **0.271±0.015** | 0.502±0.012 | **0.368±0.022** | 0.496±0.031 | 0.531±0.011 |
| *Bloom-1b1* | 0.234±0.014 | **0.507±0.012** | 0.338±0.021 | 0.485±0.031 | 0.508±0.011 |
| *Bloom-1b7* | 0.218±0.014 | 0.500±0.012 | 0.338±0.021 | **0.539±0.031** | 0.539±0.011 |
| *mGPT* | 0.229±0.014 | 0.494±0.012 | 0.332±0.021 | 0.423±0.031 | 0.517±0.011 |
| *Flor-1.3B* | 0.220±0.014 | 0.504±0.012 | 0.342±0.021 | 0.516±0.031 | 0.536±0.011 |
| *Cerebras-1.3B* | 0.221±0.014 | 0.497±0.012 | 0.300±0.021 | 0.492±0.031 | 0.531±0.011 |
## Additional information
### Contact
For further information, please send an email to <proxecto.nos@usc.gal>
### Funding
This model was development within the Nós Project, funded by the Ministerio para la Transformación Digital y de la Función Pública - Funded by EU NextGenerationEU within the framework of the [project ILENIA](https://proyectoilenia.es/) with reference 2022/TL22/00215336.
### How to cite this work
if you use this model, please cite this article:
Gamallo, Pablo, Pablo Rodríguez Fernández, Iria de Dios Flores, Susana Sotelo, Silvia Paniagua, José Ramom Pichel, Daniel Bardanca, Marcos Garcia (2024) "Open Generative Large Language Models for Galician", Procesamiento del Lenguaje Natural, 73, pp. 259-270. ISSN: 1135-5948.

33
config.json Normal file
View File

@@ -0,0 +1,33 @@
{
"_name_or_path": "/mnt/netapp1/Proxecto_NOS/adestramentos/tools/tmp/model_fp16",
"apply_residual_connection_post_layernorm": false,
"architectures": [
"BloomForCausalLM"
],
"attention_dropout": 0.0,
"attention_softmax_in_fp32": true,
"bias_dropout_fusion": true,
"bos_token_id": 50256,
"eos_token_id": 50256,
"hidden_dropout": 0.0,
"hidden_size": 2048,
"initializer_range": 0.02,
"layer_norm_epsilon": 1e-05,
"masked_softmax_fusion": true,
"model_type": "bloom",
"n_head": 16,
"n_inner": null,
"n_layer": 24,
"offset_alibi": 100,
"pad_token_id": 50256,
"pretraining_tp": 2,
"seq_length": 4096,
"skip_bias_add": true,
"skip_bias_add_qkv": false,
"slow_but_exact": false,
"torch_dtype": "float16",
"transformers_version": "4.33.2",
"unk_token_id": 0,
"use_cache": true,
"vocab_size": 50257
}

7
generation_config.json Normal file
View File

@@ -0,0 +1,7 @@
{
"_from_model_config": true,
"bos_token_id": 50256,
"eos_token_id": 50256,
"pad_token_id": 3,
"transformers_version": "4.33.2"
}

50001
merges.txt Normal file

File diff suppressed because it is too large Load Diff

3
model.safetensors Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a239a49c23ddd05e21c79d2f6f3a3cdf68d52b6925a4062e0fe95d20dec1b8db
size 2623100368

100305
tokenizer.json Normal file

File diff suppressed because it is too large Load Diff

50
tokenizer_config.json Normal file
View File

@@ -0,0 +1,50 @@
{
"add_bos_token": false,
"add_prefix_space": false,
"added_tokens_decoder": {
"50256": {
"content": "<|endoftext|>",
"lstrip": false,
"normalized": true,
"rstrip": false,
"single_word": false,
"special": true
}
},
"bos_token": {
"__type": "AddedToken",
"content": "<|endoftext|>",
"lstrip": false,
"normalized": true,
"rstrip": false,
"single_word": false
},
"clean_up_tokenization_spaces": true,
"eos_token": {
"__type": "AddedToken",
"content": "<|endoftext|>",
"lstrip": false,
"normalized": true,
"rstrip": false,
"single_word": false
},
"errors": "replace",
"model_max_length": 1000000000000000019884624838656,
"pad_token": {
"__type": "AddedToken",
"content": "<|endoftext|>",
"lstrip": false,
"normalized": true,
"rstrip": false,
"single_word": false
},
"tokenizer_class": "GPT2Tokenizer",
"unk_token": {
"__type": "AddedToken",
"content": "<|endoftext|>",
"lstrip": false,
"normalized": true,
"rstrip": false,
"single_word": false
}
}

1
vocab.json Normal file

File diff suppressed because one or more lines are too long