Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
language:
|
| 4 |
+
- es
|
| 5 |
+
- en
|
| 6 |
+
tags:
|
| 7 |
+
- ssm
|
| 8 |
+
- state-space-model
|
| 9 |
+
- mamba-like
|
| 10 |
+
- text-generation
|
| 11 |
+
- onnx
|
| 12 |
+
- onnxruntime
|
| 13 |
+
- browser
|
| 14 |
+
- experimental
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
# OxideLLM_TK_SSM_V1_ONNX
|
| 18 |
+
|
| 19 |
+
🦀 **Transformer Killer** - Versión ONNX para navegador
|
| 20 |
+
|
| 21 |
+
## ⚠️ Versión ONNX
|
| 22 |
+
|
| 23 |
+
Esta es la versión **ONNX** del modelo SSM, convertida para ejecutarse en navegadores web
|
| 24 |
+
usando ONNX Runtime Web. La versión original en PyTorch está disponible en
|
| 25 |
+
[OxideLLM_TK_SSM_V1](https://huggingface.co/ULFBERTO/OxideLLM_TK_SSM_V1).
|
| 26 |
+
|
| 27 |
+
> **Nota**: Actualmente no hay soporte nativo para PyTorch en navegadores, por lo que
|
| 28 |
+
> se requiere esta conversión a ONNX para uso web.
|
| 29 |
+
|
| 30 |
+
## Descripción
|
| 31 |
+
|
| 32 |
+
Modelo experimental basado en **State Space Models (SSM)** inspirado en Mamba,
|
| 33 |
+
que reemplaza el mecanismo de atención de los Transformers con un escaneo
|
| 34 |
+
secuencial selectivo de complejidad **O(n) lineal**.
|
| 35 |
+
|
| 36 |
+
### Especificaciones
|
| 37 |
+
|
| 38 |
+
| Aspecto | Valor |
|
| 39 |
+
|---------|-------|
|
| 40 |
+
| Arquitectura | SSM Selectivo (Mamba-like) |
|
| 41 |
+
| Parámetros | ~770K |
|
| 42 |
+
| Formato | ONNX |
|
| 43 |
+
| Tamaño | ~4 MB |
|
| 44 |
+
| Complejidad | O(n) lineal |
|
| 45 |
+
| Tokenizer | Nivel de carácter |
|
| 46 |
+
|
| 47 |
+
## Uso en Navegador (JavaScript)
|
| 48 |
+
|
| 49 |
+
```javascript
|
| 50 |
+
import * as ort from 'onnxruntime-web';
|
| 51 |
+
|
| 52 |
+
// Cargar modelo
|
| 53 |
+
const session = await ort.InferenceSession.create('ssm_model.onnx');
|
| 54 |
+
|
| 55 |
+
// Cargar tokenizer
|
| 56 |
+
const tokenizer = await fetch('tokenizer.json').then(r => r.json());
|
| 57 |
+
|
| 58 |
+
// Codificar texto
|
| 59 |
+
const text = "Hola ";
|
| 60 |
+
const inputIds = text.split('').map(c => tokenizer.char2idx[c] || 0);
|
| 61 |
+
|
| 62 |
+
// Inferencia
|
| 63 |
+
const tensor = new ort.Tensor('int64', BigInt64Array.from(inputIds.map(BigInt)), [1, inputIds.length]);
|
| 64 |
+
const outputs = await session.run({ input_ids: tensor });
|
| 65 |
+
const logits = outputs.logits.data;
|
| 66 |
+
|
| 67 |
+
// Decodificar siguiente token...
|
| 68 |
+
```
|
| 69 |
+
|
| 70 |
+
## Archivos
|
| 71 |
+
|
| 72 |
+
- `ssm_model.onnx` - Modelo ONNX (~4 MB)
|
| 73 |
+
- `tokenizer.json` - Vocabulario y configuración
|
| 74 |
+
|
| 75 |
+
## Limitaciones
|
| 76 |
+
|
| 77 |
+
⚠️ **Experimental**:
|
| 78 |
+
- Modelo pequeño (~770K params) para propósitos educativos
|
| 79 |
+
- La conversión ONNX puede tener diferencias menores vs PyTorch
|
| 80 |
+
- Algunas operaciones del SSM pueden no estar optimizadas en ONNX
|
| 81 |
+
|
| 82 |
+
## Links
|
| 83 |
+
|
| 84 |
+
- 🔥 [Versión PyTorch](https://huggingface.co/ULFBERTO/OxideLLM_TK_SSM_V1)
|
| 85 |
+
- 🌐 [Demo en ZeroCloud](https://zerocloud.vercel.app)
|
| 86 |
+
|
| 87 |
+
## Licencia
|
| 88 |
+
|
| 89 |
+
MIT License
|