Este es un modelo de lenguaje fine-tuned basado en Mistral para la generación de comunicados de prensa en español. El modelo ha sido entrenado específicamente para entender y generar contenido periodístico de alta calidad.
Uso
python
1from transformers import AutoModelForCausalLM, AutoTokenizer
23model = AutoModelForCausalLM.from_pretrained("nobanofi/nobanofi-redaccion")4tokenizer = AutoTokenizer.from_pretrained("nobanofi/nobanofi-redaccion")56# Ejemplo de uso7prompt ="Escribe un comunicado de prensa sobre el lanzamiento de un nuevo producto tecnológico"8inputs = tokenizer(prompt, return_tensors="pt")9outputs = model.generate(**inputs, max_length=500)10print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Características
Entrenado específicamente para comunicados de prensa en español
Optimizado para contenido periodístico
Basado en el modelo Mistral
Fine-tuned con datos de alta calidad
Limitaciones
El modelo está optimizado para comunicados de prensa y puede no funcionar óptimamente para otros tipos de contenido
Requiere prompts claros y específicos para mejores resultados
Fine-tuning LLMs with PEFT
This project is a tutorial on parameter-efficient fine-tuning (PEFT) and quantization of the Mistral 7B v0.1 model. We use LoRA for PEFT and 4-bit quantization to compress the model, and fine-tune the model on a semi-manually crafted fashion style recommendation instruct dataset. For more information and a step by step guide, see our blog post.
Usage
Start by cloning the repository, setting up a conda environment and installing the dependencies. We tested our scripts with python 3.9 and CUDA 11.7.
You can finetune the model on our fashion-style-instruct dataset or another dataset. Note that you will need to have the same features as our dataset and pass in your HF Hub token as an argument if using a private dataset. Fine-tuning takes about 2 hours on a single A40, you can either use the default accelerate settings or configure it to use multiple GPUS. To fine-tune the model:
One model training is completed, only the fine-tuned (LoRA) parameters are saved, which are loaded to overwrite the corresponding parameters of the base model during testing.
To test the fine-tuned model with a random sample selected from the dataset, run python test.py. To launch the full Gradio demo and play around with your own examples, launch the demo with python app.py