Instructions to use ayaxrojo/BitNet with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use ayaxrojo/BitNet with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="ayaxrojo/BitNet", filename="asistente_legal_bitnet.gguf", )
output = llm( "Once upon a time,", max_tokens=512, echo=True ) print(output)
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use ayaxrojo/BitNet with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf ayaxrojo/BitNet # Run inference directly in the terminal: llama-cli -hf ayaxrojo/BitNet
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf ayaxrojo/BitNet # Run inference directly in the terminal: llama-cli -hf ayaxrojo/BitNet
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 ayaxrojo/BitNet # Run inference directly in the terminal: ./llama-cli -hf ayaxrojo/BitNet
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 ayaxrojo/BitNet # Run inference directly in the terminal: ./build/bin/llama-cli -hf ayaxrojo/BitNet
Use Docker
docker model run hf.co/ayaxrojo/BitNet
- LM Studio
- Jan
- Ollama
How to use ayaxrojo/BitNet with Ollama:
ollama run hf.co/ayaxrojo/BitNet
- Unsloth Studio
How to use ayaxrojo/BitNet with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for ayaxrojo/BitNet to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for ayaxrojo/BitNet to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for ayaxrojo/BitNet to start chatting
- Docker Model Runner
How to use ayaxrojo/BitNet with Docker Model Runner:
docker model run hf.co/ayaxrojo/BitNet
- Lemonade
How to use ayaxrojo/BitNet with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull ayaxrojo/BitNet
Run and chat with the model
lemonade run user.BitNet-{{QUANT_TAG}}List all available models
lemonade list
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,3 +1,41 @@
|
|
| 1 |
-
---
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ⚖️ BitNet-SCJN-3.2B: Asistente Legal Mexicano (1.58-bit GGUF)
|
| 2 |
+
|
| 3 |
+
Este modelo es un asistente legal especializado en la **Jurisprudencia de la Suprema Corte de Justicia de la Nación (SCJN)** de México. Utiliza la arquitectura revolucionaria **BitNet b1.58 (ternaria)** para lograr una eficiencia extrema sin sacrificar la precisión en el razonamiento jurídico.
|
| 4 |
+
|
| 5 |
+
## 🚀 Innovaciones Técnicas
|
| 6 |
+
|
| 7 |
+
- **Arquitectura:** BitNet b1.58-bit (Pesos ternarios: {-1, 0, 1}).
|
| 8 |
+
- **Compresión:** Reducción del tamaño del modelo de ~14GB (FP16) a solo **1.4 GiB**.
|
| 9 |
+
- **Inferencia Optimizada:** Totalmente compatible con **TurboQuant** (KV Cache Quantization) y **Flash Attention**, permitiendo procesar contextos legales extensos en hardware de consumo.
|
| 10 |
+
- **Formato:** GGUF (optimizado para `llama.cpp` y `bitnet.cpp`).
|
| 11 |
+
|
| 12 |
+
## 📊 Datos de Entrenamiento
|
| 13 |
+
|
| 14 |
+
El modelo ha sido fine-tuneado mediante una época completa sobre un dataset curado de:
|
| 15 |
+
- **51,272 registros** oficiales de la SCJN.
|
| 16 |
+
- Tesis aisladas y jurisprudenciales de la Época actual.
|
| 17 |
+
- Estructura de datos optimizada para RAG (Retrieval-Augmented Generation).
|
| 18 |
+
|
| 19 |
+
## 🛠️ Cómo usar (Inferencia con llama.cpp)
|
| 20 |
+
|
| 21 |
+
Para obtener el máximo rendimiento y utilizar las optimizaciones de **TurboQuant**, se recomienda el siguiente comando:
|
| 22 |
+
|
| 23 |
+
```bash
|
| 24 |
+
./llama-cli -m asistente_legal_bitnet.gguf \
|
| 25 |
+
-p "### Sistema: Eres un Abogado Senior experto en la Jurisprudencia de la SCJN.\n### Consulta: ¿Cuál es el derecho a la privacidad?\n### Dictamen Legal:" \
|
| 26 |
+
-n 1024 \
|
| 27 |
+
-fa \
|
| 28 |
+
-ctk q4_0 -ctv q4_0 \
|
| 29 |
+
--temp 0.2 \
|
| 30 |
+
--repeat-penalty 1.15
|
| 31 |
+
```
|
| 32 |
+
|
| 33 |
+
### Parámetros Clave:
|
| 34 |
+
- `-fa`: Habilita Flash Attention.
|
| 35 |
+
- `-ctk q4_0 -ctv q4_0`: Activa la cuantización de caché KV (TurboQuant) para manejar contextos largos de jurisprudencia con un 50% menos de RAM.
|
| 36 |
+
|
| 37 |
+
## ⚖️ Disclaimer Legal
|
| 38 |
+
Este modelo es una herramienta de asistencia y apoyo para profesionales del derecho. Las respuestas generadas deben ser validadas por un abogado titulado y no constituyen asesoría legal vinculante.
|
| 39 |
+
|
| 40 |
+
---
|
| 41 |
+
**Desarrollado con ❤️ por la comunidad de IA Legal Mexicana.**
|