Instructions to use proxectonos/Carballo-cerebras-1.3B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use proxectonos/Carballo-cerebras-1.3B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="proxectonos/Carballo-cerebras-1.3B")# Load model directly from transformers import AutoTokenizer, AutoModelForMultimodalLM tokenizer = AutoTokenizer.from_pretrained("proxectonos/Carballo-cerebras-1.3B") model = AutoModelForMultimodalLM.from_pretrained("proxectonos/Carballo-cerebras-1.3B") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use proxectonos/Carballo-cerebras-1.3B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "proxectonos/Carballo-cerebras-1.3B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "proxectonos/Carballo-cerebras-1.3B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/proxectonos/Carballo-cerebras-1.3B
- SGLang
How to use proxectonos/Carballo-cerebras-1.3B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "proxectonos/Carballo-cerebras-1.3B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "proxectonos/Carballo-cerebras-1.3B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "proxectonos/Carballo-cerebras-1.3B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "proxectonos/Carballo-cerebras-1.3B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use proxectonos/Carballo-cerebras-1.3B with Docker Model Runner:
docker model run hf.co/proxectonos/Carballo-cerebras-1.3B
Carballo-cerebras-1.3B
Table of Contents
Click to expand
Model description
Carballo-cerebras-1.3BL is a 1.3B-parameter transformer-based causal language model for Galician. It is the result of a continual pretraining of a Cerebras-GPT-1.3B adapted to catalan, spanish and english previously by the AINA Project.
Intended uses and limitations
The Carballo-cerebras-1.3BL 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
import torch
from transformers import pipeline, AutoTokenizer, AutoModelForCausalLM
input_text = "Hoxe fai un bo día. O sol "
model_id = "proxectonos/Carballo-cerebras-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 and DeepSpeed with ZeRO level 2 optimizations.
Language adaptation and training
The language adaptation technique used to train Carballo-cerebras-1.3B is based in the used to train FLOR-1.3B, which is explained by their authors in this Medium Post. In summary, we proceeded as follows:
- We trained our own BPE tokenizer for galician and replaced the tokenizer and vocabulary of the base model with it.
- The embeddings corresponding to tokens that are present in both the original and the target vocabulary (matching tokens) were used for initialization.
- The embeddings from tokens not present in Carballo-cerebras-1.3B's original vocabulary were initialized as the average of all embeddings.
- The model was initialized with the original weights and with our adapted tokenizer (step 1) and embeddings (steps 2-3).
- The model was then trained on a galician corpus.
Training data
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 training was conducted in the Galicia Supercomputing Center (CESGA), using 4 nodes with 2 GPUs NVIDIA A100 (8GPUS in total)
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 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.
- Downloads last month
- 58