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
| # ⚖️ BitNet-SCJN-3.2B: Asistente Legal Mexicano (1.58-bit GGUF) | |
| 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. | |
| ## 🚀 Innovaciones Técnicas | |
| - **Arquitectura:** BitNet b1.58-bit (Pesos ternarios: {-1, 0, 1}). | |
| - **Compresión:** Reducción del tamaño del modelo de ~14GB (FP16) a solo **1.4 GiB**. | |
| - **Inferencia Optimizada:** Totalmente compatible con **TurboQuant** (KV Cache Quantization) y **Flash Attention**, permitiendo procesar contextos legales extensos en hardware de consumo. | |
| - **Formato:** GGUF (optimizado para `llama.cpp` y `bitnet.cpp`). | |
| ## 📊 Datos de Entrenamiento | |
| El modelo ha sido fine-tuneado mediante una época completa sobre un dataset curado de: | |
| - **51,272 registros** oficiales de la SCJN. | |
| - Tesis aisladas y jurisprudenciales de la Época actual. | |
| - Estructura de datos optimizada para RAG (Retrieval-Augmented Generation). | |
| ## 🛠️ Cómo usar (Inferencia con llama.cpp) | |
| Para obtener el máximo rendimiento y utilizar las optimizaciones de **TurboQuant**, se recomienda el siguiente comando: | |
| ```bash | |
| ./llama-cli -m asistente_legal_bitnet.gguf \ | |
| -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:" \ | |
| -n 1024 \ | |
| -fa \ | |
| -ctk q4_0 -ctv q4_0 \ | |
| --temp 0.2 \ | |
| --repeat-penalty 1.15 | |
| ``` | |
| ### Parámetros Clave: | |
| - `-fa`: Habilita Flash Attention. | |
| - `-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. | |
| ## ⚖️ Disclaimer Legal | |
| 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. | |
| --- | |
| **Desarrollado con ❤️ por la comunidad de IA Legal Mexicana.** | |