Text Generation
Transformers
Safetensors
GGUF
Spanish
llama
spanish
español
tiny
from-scratch
distillation
conversational
text-generation-inference
Instructions to use AxoneSystem/Minerva-v0.1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AxoneSystem/Minerva-v0.1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="AxoneSystem/Minerva-v0.1") 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("AxoneSystem/Minerva-v0.1") model = AutoModelForCausalLM.from_pretrained("AxoneSystem/Minerva-v0.1", 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
- llama.cpp
How to use AxoneSystem/Minerva-v0.1 with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf AxoneSystem/Minerva-v0.1:F16 # Run inference directly in the terminal: llama cli -hf AxoneSystem/Minerva-v0.1:F16
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf AxoneSystem/Minerva-v0.1:F16 # Run inference directly in the terminal: llama cli -hf AxoneSystem/Minerva-v0.1:F16
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf AxoneSystem/Minerva-v0.1:F16 # Run inference directly in the terminal: ./llama-cli -hf AxoneSystem/Minerva-v0.1:F16
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf AxoneSystem/Minerva-v0.1:F16 # Run inference directly in the terminal: ./build/bin/llama-cli -hf AxoneSystem/Minerva-v0.1:F16
Use Docker
docker model run hf.co/AxoneSystem/Minerva-v0.1:F16
- LM Studio
- Jan
- vLLM
How to use AxoneSystem/Minerva-v0.1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "AxoneSystem/Minerva-v0.1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AxoneSystem/Minerva-v0.1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/AxoneSystem/Minerva-v0.1:F16
- SGLang
How to use AxoneSystem/Minerva-v0.1 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 "AxoneSystem/Minerva-v0.1" \ --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": "AxoneSystem/Minerva-v0.1", "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 "AxoneSystem/Minerva-v0.1" \ --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": "AxoneSystem/Minerva-v0.1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use AxoneSystem/Minerva-v0.1 with Ollama:
ollama run hf.co/AxoneSystem/Minerva-v0.1:F16
- Unsloth Desktop
- Docker Model Runner
How to use AxoneSystem/Minerva-v0.1 with Docker Model Runner:
docker model run hf.co/AxoneSystem/Minerva-v0.1:F16
- Lemonade
How to use AxoneSystem/Minerva-v0.1 with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull AxoneSystem/Minerva-v0.1:F16
Run and chat with the model
lemonade run user.Minerva-v0.1-F16
List all available models
lemonade list
- Atomic Chat
File size: 5,273 Bytes
101bfba | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | ---
language:
- es
license: cc-by-nc-4.0
library_name: transformers
pipeline_tag: text-generation
tags:
- spanish
- español
- tiny
- llama
- gguf
- from-scratch
- distillation
datasets:
- robrenaud/multilingual_tinystories
- FreedomIntelligence/alpaca-gpt4-spanish
---
# Minerva v0.1 🇪🇸
**Minerva** es un modelo de lenguaje en español **diminuto** (30 millones de parámetros), entrenado
**desde cero** en un ordenador portátil. Es un modelo de juguete y de aprendizaje: habla español con
soltura y cuenta cuentos sencillos, pero **sabe muy poco del mundo y se inventa las cosas**.
El nombre viene de Minerva, diosa romana de la sabiduría, que según el mito nació de la cabeza de Júpiter.
Este modelo también "nació de la cabeza" de modelos más grandes: aprendió de textos escritos por ellos
(destilación).
## Qué sabe hacer (y qué no)
| ✅ Sí | ❌ No |
|---|---|
| Escribir en español con buena gramática | Dar datos fiables (se los inventa con seguridad) |
| Contar cuentos infantiles coherentes | Matemáticas, razonamiento, programación |
| Charlar con frases sencillas | Recordar conversaciones largas (ve unas 350 palabras) |
| Decir quién es y por qué se llama así | Cualquier uso serio: **no lo uses para decisiones reales** |
## Ejemplos reales
Respuestas generadas automáticamente al exportar el modelo (temperatura 0.7, sin escoger las mejores):
> **Tú:** ¿Quién eres?
> **Minerva:** Soy Minerva, un modelo de lenguaje español. No soy una persona, soy un programa de ordenador.
> **Tú:** ¿Por qué te llamas Minerva?
> **Minerva:** Me llamo así por Minerva, la diosa romana de la sabiduría. Según el mito, nació de la cabeza de Júpiter. Yo también nací de la cabeza de modelos más grandes: ellos me enseñaron y yo aprendí de sus respuestas.
> **Tú:** ¿Cuál es la capital de España?
> **Minerva:** La capital de España es Aragón.
> **Tú:** ¿Qué es la paella?
> **Minerva:** La paella es una tienda minorista que consiste en marcas y compresas para vender productos crudos.
> **Tú:** Dame un consejo para dormir mejor.
> **Minerva:** No es bueno dormir mucho. Es importante estar preparado para dormir. Las personas no pueden sentir que algo no estaba bien, y es importante tomarse un descanso y tomar descansos.
> **Cuento** (empieza con «Había una vez un dragón que»):
> Había una vez un dragón que podría volar. El dragón estaba enojado porque no había nadie que pudiera ayudar.
## Cómo usarlo
### Con LM Studio u Ollama (sin programar)
El repositorio incluye el archivo `Minerva-v0.1-F16.gguf`.
- **LM Studio**: busca `AxoneSystem/Minerva-v0.1` y descárgalo.
- **Ollama**: `ollama run hf.co/AxoneSystem/Minerva-v0.1`
### Con Python (`transformers`)
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
tok = AutoTokenizer.from_pretrained("AxoneSystem/Minerva-v0.1")
modelo = AutoModelForCausalLM.from_pretrained("AxoneSystem/Minerva-v0.1")
mensajes = [{"role": "user", "content": "¿Quién eres?"}]
ids = tok.apply_chat_template(mensajes, add_generation_prompt=True, return_tensors="pt")
salida = modelo.generate(ids, max_new_tokens=150, do_sample=True, temperature=0.7, top_k=30)
print(tok.decode(salida[0, ids.shape[1]:], skip_special_tokens=True))
```
Para que cuente un cuento, dale el principio sin plantilla de chat: `"Había una vez un gato que"`.
### Formato de chat
```
<|usuario|>¿Quién eres?<|asistente|>Soy Minerva, un modelo de lenguaje muy pequeño...<|fin|>
```
## Cómo se entrenó
| | |
|---|---|
| Arquitectura | Transformer decodificador tipo Llama: RMSNorm, RoPE, SwiGLU, embeddings compartidos |
| Tamaño | 30M parámetros · 8 capas · 512 dimensiones · 8 cabezas · contexto de 512 tokens |
| Tokenizador | BPE byte-level propio, 8.192 piezas, entrenado solo con español |
| Hardware | 1 portátil con NVIDIA RTX 5070 Laptop (8 GB) |
| Tiempo | ~1 h de preentreno + ~1 h de destilación y ajuste |
1. **Preentreno** (~280M tokens vistos): ~1 millón de cuentos infantiles en español escritos por
Gemini 1.5 Flash (`robrenaud/multilingual_tinystories`) + ~50.000 respuestas de GPT-4 en español
(`FreedomIntelligence/alpaca-gpt4-spanish`). Objetivo: predecir la siguiente palabra.
2. **Destilación**: [Salamandra-2B-Instruct](https://huggingface.co/BSC-LT/salamandra-2b-instruct)
(Barcelona Supercomputing Center) respondió miles de preguntas **de forma sencilla y corta**, para
que un modelo tan pequeño pudiera imitarlo.
3. **Ajuste de chat**: aprende a responder solo con las partes del asistente (las preguntas no cuentan
en el aprendizaje) + unas decenas de respuestas escritas a mano sobre su identidad.
Pérdida de validación final en el ajuste de chat: 2.242.
El código completo de entrenamiento está en la carpeta `entrenamiento/`.
## Licencia
**CC BY-NC 4.0** (uso no comercial). Parte de los datos de ajuste son respuestas de GPT-4 que proceden de
Alpaca-GPT4, publicado solo para investigación y uso no comercial; por prudencia el modelo hereda esa
restricción. Los cuentos (Apache-2.0) y el maestro Salamandra (Apache-2.0) no tienen esa limitación.
|