Text Generation
Transformers
Safetensors
llama
Salamandra
Instruction-tuning
Multilingual
conversational
text-generation-inference
Instructions to use proxectonos/Carvalho-Salamandra-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use proxectonos/Carvalho-Salamandra-Instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="proxectonos/Carvalho-Salamandra-Instruct") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("proxectonos/Carvalho-Salamandra-Instruct") model = AutoModelForCausalLM.from_pretrained("proxectonos/Carvalho-Salamandra-Instruct", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use proxectonos/Carvalho-Salamandra-Instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "proxectonos/Carvalho-Salamandra-Instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "proxectonos/Carvalho-Salamandra-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/proxectonos/Carvalho-Salamandra-Instruct
- SGLang
How to use proxectonos/Carvalho-Salamandra-Instruct 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/Carvalho-Salamandra-Instruct" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "proxectonos/Carvalho-Salamandra-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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/Carvalho-Salamandra-Instruct" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "proxectonos/Carvalho-Salamandra-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use proxectonos/Carvalho-Salamandra-Instruct with Docker Model Runner:
docker model run hf.co/proxectonos/Carvalho-Salamandra-Instruct
| library_name: transformers | |
| license: mit | |
| language: | |
| - gl | |
| - pt | |
| - es | |
| - en | |
| - ca | |
| base_model: | |
| - BSC-LT/salamandra-7b-instruct | |
| pipeline_tag: text-generation | |
| tags: | |
| - Salamandra | |
| - Instruction-tuning | |
| - Multilingual | |
| datasets: | |
| - proxectonos/cpt_instruction_datasets | |
| # Carvalho-Salamandra-Instruct | |
| > [!WARNING] | |
| > **WARNING:** This is a preliminary version of Carvalho-Salamandra-Instruct. | |
| ## Table of Contents | |
| <details> | |
| <summary>Click to expand</summary> | |
| - [Carvalho-Salamandra-Instruct](#carvalho-salamandra-instruct) | |
| - [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) | |
| - [Training data](#training-data) | |
| - [Training hyperparameters](#training-hyperparameters) | |
| - [Framework](#framework) | |
| - [Evaluation](#evaluation) | |
| - [Additional information](#additional-information) | |
| - [Funding](#funding) | |
| - [Cite this model](#cite-this-model) | |
| </details> | |
| ## Model description | |
| **Carvalho-Salamandra-Instruct** is a 7B-parameter instruction-tuned transformer model covering Galician, Portuguese, Spanish, English and Catalan. | |
| It is based on [BSC-LT/salamandra-7b-instruct](https://huggingface.co/BSC-LT/salamandra-7b-instruct) and was further adapted through a 1-epoch training run using high-quality multilingual corpora, with a marked emphasis on Galician and Portuguese. | |
| This model aims to provide strong instruction-following and generation capabilities for underrepresented languages while maintaining robust multilingual behavior. | |
| ## Intended uses and limitations | |
| **Intended uses** | |
| - Instruction following and dialogue-style generation. | |
| - Multilingual text generation and content creation. | |
| - Downstream fine-tuning for tasks such as summarization, classification, or question answering (with appropriate supervised data). | |
| **Limitations** | |
| - Not intended as a sole source for high-stakes or safety-critical decisions. | |
| - May produce incorrect or biased factual information — verify outputs when accuracy matters. | |
| - Performance may vary by language and domain; best results in Galician and Portuguese given training emphasis. | |
| ## How to use | |
| ```python | |
| from datetime import datetime | |
| from transformers import AutoTokenizer, AutoModelForCausalLM | |
| import transformers | |
| import torch | |
| model_id = "proxectonos/Carvalho-Salamandra-Instruct" | |
| text = "Qué sabes sobre o Proxecto Nós?" | |
| tokenizer = AutoTokenizer.from_pretrained(model_id) | |
| model = AutoModelForCausalLM.from_pretrained( | |
| model_id, | |
| device_map="auto", | |
| torch_dtype=torch.bfloat16 | |
| ) | |
| message = [ { "role": "user", "content": text } ] | |
| date_string = datetime.today().strftime('%Y-%m-%d') | |
| prompt = tokenizer.apply_chat_template( | |
| message, | |
| tokenize=False, | |
| add_generation_prompt=True, | |
| date_string=date_string | |
| ) | |
| inputs = tokenizer.encode(prompt, add_special_tokens=False, return_tensors="pt") | |
| outputs = model.generate(input_ids=inputs.to(model.device), max_new_tokens=200) | |
| generated_tokens = outputs[0][len(inputs[0]):] | |
| response = self.tokenizer.decode(generated_tokens, skip_special_tokens=False).strip() | |
| response = response.split("<|reserved_token_1|>")[0].strip() | |
| print(response) | |
| ``` | |
| ## Training | |
| ### Training data | |
| The model was trained with a mix of instruction data and high-quality monolingual corpora, designed to maximize performance in Galician and Portuguese while preserving broad multilingual capabilities. | |
| | **Dataset Type** | **Languages** | **Tokens per language/Source** | | |
| |----------------------|------------------------------|------------| | |
| | Full instruction set | GL , ES , PT , CAT , EN | [Galician Instruction Datasets](https://github.com/proxectonos/instruction_datasets) | | |
| | High-quality corpus | GL, PT | 250M | | |
| | Small HQ corpus | EN, ES, CAT | 30M | | |
| ### Training hyperparameters | |
| - **epochs:** 1 | |
| - **dtype:** bf16 | |
| - **block size:** 2048 | |
| - **total batch size:** 128 | |
| - **learning rate:** 2e-6 | |
| - **scheduler:** Linear | |
| - **optimizations:** | |
| - gradient checkpointing: True | |
| - flash attention: True | |
| - liger kernels: True | |
| - DeepSpeed stage: 2 | |
| ### Framework | |
| Training was performed at the **Galician Supercomputing Center (CESGA)** using **2 nodes** (each with **2× NVIDIA A100 40GB**) — a total of **4 GPUs** — across **2 days**. | |
| ## Evaluation | |
| Formal evaluation is ongoing. Preliminary internal tests show strong instruction-following ability and improved generation quality for Galician and Portuguese compared to the base model. Detailed benchmarks and quantitative results will be added when available. | |
| ## Additional information | |
| ## Funding | |
| This work is 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 Desarrollo de Modelos ALIA | |
| ### Cite this model | |
| Please cite this model as: | |
| ``` | |
| @misc{carvalho_salamandra_instruct_2025, | |
| title = {Carvalho-Salamandra-Instruct: A Multilingual Instruction-Tuned Model for Underrepresented Languages}, | |
| author = {Proxecto Nós Team}, | |
| year = {2025}, | |
| publisher = {HuggingFace}, | |
| howpublished = {\url{https://huggingface.co/proxectonos/Carvalho-Salamandra-Instruct}}, | |
| } | |
| ``` |