| --- |
| language: es |
| license: apache-2.0 |
| tags: |
| - text-generation |
| - transformer |
| - pytorch |
| --- |
| |
| # MTP Mini - Modelo de Lenguaje |
|
|
| Modelo transformer entrenado con las siguientes características: |
|
|
| ## Arquitectura |
| - **Parámetros**: ~474.3M |
| - **Vocabulario**: 8000 tokens |
| - **Capas**: 24 |
| - **Dimensión**: 1024 |
| - **Cabezas de atención**: 16 |
|
|
| ## Mejoras implementadas |
| - ✅ RoPE (Rotary Position Embedding) |
| - ✅ RMSNorm |
| - ✅ SwiGLU activation |
| - ✅ Label smoothing |
| - ✅ Repetition penalty |
| - ✅ Early stopping |
| - ✅ Length control |
|
|
| ## Uso |
|
|
| ```python |
| import torch |
| import pickle |
| |
| # Cargar modelo |
| with open('mtp_mini.pkl', 'rb') as f: |
| model_data = pickle.load(f) |
| |
| # Cargar tokenizer |
| from tokenizer import MTPTokenizer |
| tokenizer = MTPTokenizer('mtp_tokenizer.model') |
| |
| # Cargar modelo |
| from model import MTPMiniModel |
| model = MTPMiniModel(**model_data['config']['model']) |
| model.load_state_dict(model_data['model_state_dict']) |
| model.eval() |
| |
| # Generar texto |
| prompt = "¿Qué es la inteligencia artificial?" |
| input_ids = torch.tensor([tokenizer.encode(prompt)]) |
| output = model.generate(input_ids, max_new_tokens=100) |
| print(tokenizer.decode(output[0].tolist())) |
| ``` |
|
|
| ## Entrenamiento |
| - Dataset: Corpus personalizado en español |
| - Épocas: 0 |
| - Mejor val loss: 2.2518 |
|
|
| Entrenado en Google Colab. |
|
|