Run this model with HF Jobs
Run gplsi/5W1H_Llama_3B on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/gplsi/5W1H_Llama_3B. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/gplsi/5W1H_Llama_3B on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/gplsi/5W1H_Llama_3B. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/gplsi/5W1H_Llama_3B. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use gplsi/5W1H_Llama_3B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use gplsi/5W1H_Llama_3B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="gplsi/5W1H_Llama_3B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("gplsi/5W1H_Llama_3B") model = AutoModelForCausalLM.from_pretrained("gplsi/5W1H_Llama_3B", 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use gplsi/5W1H_Llama_3B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "gplsi/5W1H_Llama_3B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "gplsi/5W1H_Llama_3B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/gplsi/5W1H_Llama_3B
- SGLang
How to use gplsi/5W1H_Llama_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 "gplsi/5W1H_Llama_3B" \ --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": "gplsi/5W1H_Llama_3B", "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 "gplsi/5W1H_Llama_3B" \ --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": "gplsi/5W1H_Llama_3B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use gplsi/5W1H_Llama_3B with Docker Model Runner:
docker model run hf.co/gplsi/5W1H_Llama_3B
5W1H_Llama_3B
Descripción
Modelo ajustado a partir de meta-llama/Llama-3.2-3B-Instruct para extraer etiquetas 5W1H en español. Entrenado con Lightning Fabric usando el chat template de LLaMA 3.2.
La tarea principal del modelo es la extracción de 5W1H (WHAT, WHEN, WHERE, WHY, WHO, HOW), es decir, identificar y etiquetar las palabras o frases clave en un texto según estas categorías.
Dataset
El dataset utilizado se puede descargar desde: Dataset de las 5W1H.
Formato utilizado para realizar el fine-tuning y la inferencia en el modelo.
[
{
"role": "system",
"content": """Eres un experto en lengua española. Tu tarea es identificar y etiquetar las palabras o frases clave de un TEXTO dado según las siguientes categorías:
WHAT: Describe la acción, suceso o idea principal del texto.)
WHEN: Señala el momento o duración en que ocurre el suceso.
WHERE: Indica el lugar donde ocurre el suceso.
WHY: Explica la causa o razón detrás del suceso.
WHO: Define las entidades, personas o grupos que participan o son afectados por el suceso.
HOW: Describe las circunstancias o la forma en que sucede el hecho.
Por favor, coloca la categoría correspondiente entre corchetes justo antes o después de la palabra o frase relevante."""
},
{
"role": "user",
"content": "Texto: Esto se refleja en la ocupación de unidades de cuidados intensivos (UCI), lo que se agrava con la llegada de pacientes remitidos de otras ciudades de la región."
},
{
"role": "assistant",
"content": "Esto se refleja [WHERE]en la ocupación de unidades de cuidados intensivos (UCI)[/WHERE], lo que se agrava [HOW]con la llegada de pacientes[/HOW] remitidos [WHERE]de otras ciudades de la región[/WHERE]."
}
]
Parámetros de entrenamiento
- epochs: 5
- learning_rate: 1e-5
- beta1: 0.9
- beta2: 0.95
- weight_decay: 0.1
- batch_size global: 4
- micro_batch_size: 1
- lr_warmup_steps: 100
- max_seq_length: 512
Resultados por clase (5W1H)
Las métricas aplicadas se pueden replicar usando el código del siguiente repositorio: Métricas para la tarea de 5W1H.
| Clase | Correct (Ca) | Incorrect (Ia) | Partial (Pa) | Missing (Ma) | Spurious (Sa) | Precision | Recall | F1 Score | Accuracy |
|---|---|---|---|---|---|---|---|---|---|
| WHAT | 343 | 21 | 198 | 143 | 166 | 0.6071 | 0.6270 | 0.6169 | 0.5075 |
| WHEN | 119 | 7 | 21 | 35 | 30 | 0.7316 | 0.7115 | 0.7214 | 0.6108 |
| WHERE | 120 | 12 | 21 | 60 | 15 | 0.7768 | 0.6127 | 0.6850 | 0.5724 |
| WHO | 328 | 15 | 69 | 64 | 55 | 0.7762 | 0.7616 | 0.7688 | 0.6827 |
| WHY | 23 | 3 | 9 | 26 | 13 | 0.5729 | 0.4508 | 0.5046 | 0.3716 |
| HOW | 54 | 18 | 13 | 72 | 37 | 0.4959 | 0.3854 | 0.4337 | 0.3119 |
Promedios generales (macro)
| Métrica | Valor |
|---|---|
| Precision | 0.6740 |
| Recall | 0.6424 |
| F1 Score | 0.6578 |
| Accuracy | 0.5462 |
Referencia
@misc{gplsi-5w1h-llama3b,
author = {Sepúlveda-Torres, Robiert and Bonet-Jover, Alba and Mármol-Romero, Alba María and Cabrera-de-Castro and Saquete, Estela and Martínez-Barco, Patricio and Martín-Valdivia, M. Teresa and L. Alfonso Ureña-López},
title = {5W1H Extractor Fine-Tuned from Llama-3B-Instruct},
year = {2025},
howpublished = {\url{https://huggingface.co/gplsi/5W1H_Llama_3B}},
note = {Accessed: 2025-05-28}
}
- Downloads last month
- 12
Model tree for gplsi/5W1H_Llama_3B
Base model
meta-llama/Llama-3.2-3B-Instruct