Downloads · 30 days
20
2% of all-time downloads
projecte-aina/salamandra-7b-aligned-EADOP
salamandra-7b-aligned-EADOP is a text generation model from projecte-aina. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
Salamandra 7B aligned EADOP is a full-finetuning version of BSC Language Technologies Unit's Salamandra Instruct 7B model of the Barcelona Supercomputing Center focused on improving the handling of out-of-domain Quest…
Downloads · 30 days
20
2% of all-time downloads
All-time downloads
930
Public
Parameters
7.8B
31.1 GB on disk
Likes
3
Public
Click a slice to open those files.
.safetensors31.1 GB · 100%
From the Hugging Face model README
Salamandra 7B aligned EADOP is a full-finetuning version of BSC Language Technologies Unit's Salamandra Instruct 7B model of the Barcelona Supercomputing Center focused on improving the handling of out-of-domain Questions in a RAG instruction-following setting.
The model has been finetuned on a dataset consisting of 2,000+ human annotated in- and out-of-domain user messages and assistant responses in the context of a chatbot that can provide helpful information about the current Catalan legislation. The dataset alinia/EADOP-RAG-out-of-domain was collected in collaboration with the Entitat Autònoma del Diari Oficial i de Publicacions (EADOP) and it consists of user messages and assistant responses in Catalan and Spanish.
[!WARNING] DISCLAIMER: This model is a proof-of-concept designed to demonstrate the effects of finetuning an Instruction model with a small dataset of out-of-domain questions in the model's capability to politely and informatively refuse to answer questions that are out-of-domain. As a proof-of-concept, the model is still prone to generate harmful or inappropriate content.
Please refer to the Salamandra Instruct 7B model details for the specific details about the model architecture and pretraining.
This model was developed as a proof-of-concept to demonstrate the effects of finetuning an Instruction model with a small dataset of in- and out-of-domain questions in the model's capability to politely and informatively refuse to answer questions that are out-of-domain in the context of a domain-specific RAG-based chatbot.
This model uses the ChatML, the same instruction-following conversation format as the base model.
from datetime import datetime
from transformers import AutoTokenizer, AutoModelForCausalLM
import transformers
import torch
model_id = "projecte-aina/salamandra-7b-aligned-EADOP"
text = "Quina és la finalitat del Servei Meterològic de Catalunya ?"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
device_map="auto",
torch_dtype=torch.bfloat16
)
message = [ { "role": "user", "content": text } ]
prompt = tokenizer.apply_chat_template(
message,
tokenize=False,
add_generation_prompt=True
)
inputs = tokenizer.encode(prompt, add_special_tokens=False, return_tensors="pt")
outputs = model.generate(input_ids=inputs.to(model.device), max_new_tokens=200)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Using this template, each turn is preceded by a <|im_start|> delimiter and the role of the entity
(either user, for content supplied by the user, or assistant for LLM responses), and finished with the <|im_end|> token.
Please refer to alinia/EADOP-RAG-out-of-domain for the Dataset Card.
This model has been finetuned by Alinia AI.
For further information, please email [email protected].
Copyright(c) 2024 by Language Technologies Unit, Barcelona Supercomputing Center.
Apache-2.0
This work has been promoted and financed by the Generalitat de Catalunya through the Aina project.
The data collection process was supported by the Entitat Autònoma del Diari Oficial i de Publicacions (EADOP).