Instructions to use ayaxrojo/scjn-tesis_v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ayaxrojo/scjn-tesis_v1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ayaxrojo/scjn-tesis_v1") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("ayaxrojo/scjn-tesis_v1", dtype="auto") - llama-cpp-python
How to use ayaxrojo/scjn-tesis_v1 with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="ayaxrojo/scjn-tesis_v1", filename="modelo_7b-F16.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use ayaxrojo/scjn-tesis_v1 with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf ayaxrojo/scjn-tesis_v1:Q4_K_M # Run inference directly in the terminal: llama-cli -hf ayaxrojo/scjn-tesis_v1:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf ayaxrojo/scjn-tesis_v1:Q4_K_M # Run inference directly in the terminal: llama-cli -hf ayaxrojo/scjn-tesis_v1:Q4_K_M
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/scjn-tesis_v1:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf ayaxrojo/scjn-tesis_v1:Q4_K_M
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/scjn-tesis_v1:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf ayaxrojo/scjn-tesis_v1:Q4_K_M
Use Docker
docker model run hf.co/ayaxrojo/scjn-tesis_v1:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use ayaxrojo/scjn-tesis_v1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ayaxrojo/scjn-tesis_v1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ayaxrojo/scjn-tesis_v1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ayaxrojo/scjn-tesis_v1:Q4_K_M
- SGLang
How to use ayaxrojo/scjn-tesis_v1 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 "ayaxrojo/scjn-tesis_v1" \ --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": "ayaxrojo/scjn-tesis_v1", "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 "ayaxrojo/scjn-tesis_v1" \ --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": "ayaxrojo/scjn-tesis_v1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use ayaxrojo/scjn-tesis_v1 with Ollama:
ollama run hf.co/ayaxrojo/scjn-tesis_v1:Q4_K_M
- Unsloth Studio new
How to use ayaxrojo/scjn-tesis_v1 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/scjn-tesis_v1 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/scjn-tesis_v1 to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for ayaxrojo/scjn-tesis_v1 to start chatting
- Pi new
How to use ayaxrojo/scjn-tesis_v1 with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf ayaxrojo/scjn-tesis_v1:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "ayaxrojo/scjn-tesis_v1:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use ayaxrojo/scjn-tesis_v1 with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf ayaxrojo/scjn-tesis_v1:Q4_K_M
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default ayaxrojo/scjn-tesis_v1:Q4_K_M
Run Hermes
hermes
- Docker Model Runner
How to use ayaxrojo/scjn-tesis_v1 with Docker Model Runner:
docker model run hf.co/ayaxrojo/scjn-tesis_v1:Q4_K_M
- Lemonade
How to use ayaxrojo/scjn-tesis_v1 with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull ayaxrojo/scjn-tesis_v1:Q4_K_M
Run and chat with the model
lemonade run user.scjn-tesis_v1-Q4_K_M
List all available models
lemonade list
- ⚖️ Asistente Jurídico MX — Qwen 2.5 7B (Fine-tuned)
⚖️ Asistente Jurídico MX — Qwen 2.5 7B (Fine-tuned)
Modelo de lenguaje ajustado fino sobre Qwen 2.5 7B Instruct, especializado en derecho mexicano. Entrenado con tesis y jurisprudencias de la Suprema Corte de Justicia de la Nación (SCJN).
El objetivo principal es democratizar el acceso a la información jurídica en México, ofreciendo versiones optimizadas para distintos tipos de hardware — desde servidores con GPU hasta computadoras modestas sin acelerador gráfico.
💰 Uso Gratuito: Este modelo es completamente gratuito para uso personal, educativo y de investigación. Consulta el archivo LICENSE para más detalles.
📄 Model Card: Consulta MODELCARD.md para información detallada sobre el modelo, entrenamiento, y consideraciones éticas.
📋 Versiones Disponibles del Modelo
| Versión | Archivo .gguf |
Tamaño | Descripción |
|---|---|---|---|
| F16 (base completo) | modelo_7b-F16.gguf |
~15 GB | Precisión completa, máxima calidad |
| Q4_K_M ⭐ (recomendado) | modelo_7b_q4_k_m.gguf |
~4.4 GB | Mejor equilibrio calidad/tamaño |
| Q3_K_M | modelo_7b_q3_k_m.gguf |
~3.6 GB | Para máquinas con recursos limitados |
| Q2_K | modelo_7b_q2_k.gguf |
~2.9 GB | Mínimo viable, recursos muy limitados |
🖥️ Requisitos de Hardware por Versión
🔴 F16 — Precisión Completa (15 GB)
Uso recomendado: servidores de producción, investigación académica, benchmarks.
| Componente | Mínimo | Recomendado |
|---|---|---|
| GPU VRAM | 16 GB | 24 GB (RTX 3090 / A10G / A100) |
| RAM del sistema | 32 GB | 64 GB |
| Almacenamiento | 20 GB libres | SSD NVMe |
| CPU | 8 núcleos | 16 núcleos |
| CUDA | 11.8+ | 12.x |
# Ejecutar con Ollama (F16)
ollama run qwen2.5:7b-instruct-fp16
🟡 Q4_K_M — Cuantización 4-bit (4.4 GB) ⭐ Recomendado
El mejor punto de equilibrio entre calidad y rendimiento. Versión recomendada para la mayoría de usuarios.
| Componente | Mínimo | Recomendado |
|---|---|---|
| GPU VRAM | 6 GB | 8 GB (RTX 3060 / RTX 4060 / GTX 1080 Ti) |
| RAM del sistema | 8 GB | 16 GB |
| Almacenamiento | 6 GB libres | SSD |
| CPU | 4 núcleos | 8 núcleos |
| SO | Windows 10/11, Ubuntu 20.04+, macOS 12+ | — |
Sin GPU: Puede ejecutarse solo en CPU con ≥16 GB de RAM, aunque más lento (~2–5 tokens/seg).
# Ejecutar con Ollama (Q4_K_M) — más rápido si solo tienes CPU
ollama run modelo-juridico-mx
# Ejecutar directamente con llama.cpp
./llama-cli -m modelo_7b_q4_k_m.gguf \
-ngl 35 \
-c 8192 \
--temp 0.3 \
-p "<|im_start|>system\nEres un asistente jurídico especializado en derecho mexicano.<|im_end|>\n<|im_start|>user\n¿Qué es el amparo?<|im_end|>\n<|im_start|>assistant\n"
🟠 Q3_K_M — Cuantización 3-bit (3.6 GB)
Para laptops o PCs con recursos limitados. Calidad ligeramente reducida pero funcional.
| Componente | Mínimo | Recomendado |
|---|---|---|
| GPU VRAM | 4 GB | 6 GB (GTX 1650 / RTX 3050) |
| RAM del sistema | 6 GB | 12 GB |
| Almacenamiento | 5 GB libres | HDD o SSD |
| CPU | 4 núcleos | 6 núcleos |
| SO | Windows 10/11, Ubuntu 18.04+, macOS 11+ | — |
Sin GPU: Funciona en CPU con ≥8 GB RAM. Velocidad estimada: ~1–3 tokens/seg.
# Ejecutar con llama.cpp (Q3_K_M, solo CPU)
./llama-cli -m modelo_7b_q3_k_m.gguf \
-ngl 0 \
-c 4096 \
--temp 0.3 \
--threads 6
🔵 Q2_K — Cuantización 2-bit (2.9 GB)
Para máquinas muy limitadas. Es el mínimo aceptable; la calidad de respuestas puede verse afectada en consultas complejas.
| Componente | Mínimo | Recomendado |
|---|---|---|
| GPU VRAM | Sin GPU requerida | 4 GB si disponible |
| RAM del sistema | 4 GB | 8 GB |
| Almacenamiento | 4 GB libres | HDD o SSD |
| CPU | 2 núcleos | 4 núcleos |
| SO | Windows 10/11, Ubuntu 18.04+, macOS 10.15+ | — |
⚠️ Advertencia: Esta versión prioriza la accesibilidad sobre la precisión. Puede omitir matices jurídicos o generar respuestas menos detalladas.
# Ejecutar con llama.cpp (Q2_K, solo CPU)
./llama-cli -m modelo_7b_q2_k.gguf \
-ngl 0 \
-c 2048 \
--temp 0.3 \
--threads 4
📊 Tabla Comparativa Rápida
| Versión | Tamaño | RAM mín. | GPU mín. | CPU solo | Velocidad aprox. | Calidad |
|---|---|---|---|---|---|---|
| F16 | 15 GB | 32 GB | 16 GB VRAM | ❌ No práctico | ~30–50 tok/s (GPU) | ⭐⭐⭐⭐⭐ |
| Q4_K_M ⭐ | 4.4 GB | 8 GB | 6 GB VRAM | ✅ (≥16 GB RAM) | ~15–30 tok/s (GPU) / ~2–5 tok/s (CPU) | ⭐⭐⭐⭐ |
| Q3_K_M | 3.6 GB | 6 GB | 4 GB VRAM | ✅ (≥8 GB RAM) | ~10–20 tok/s (GPU) / ~1–3 tok/s (CPU) | ⭐⭐⭐ |
| Q2_K | 2.9 GB | 4 GB | Sin GPU | ✅ (≥4 GB RAM) | ~1–2 tok/s (CPU) | ⭐⭐ |
🔒 Verificación de Integridad
Antes de usar los modelos, verifica la integridad de los archivos descargados:
# Verificar checksums SHA256
sha256sum -c CHECKSUMS.txt
Checksums SHA256
| Archivo | SHA256 |
|---|---|
modelo_7b-F16.gguf |
d61fec6a9263172872626c959f20d7b23540201d791433710e819be234c36cb0 |
modelo_7b_q4_k_m.gguf |
285bb2cb73626186dea5f1ad3ac310446615ae645cc4b001074ac5a11e236ce2 |
modelo_7b_q3_k_m.gguf |
cde75c846845ad3a4cca5f9247458caf2d0f18e3505567252080a55caf81b08b |
modelo_7b_q2_k.gguf |
780fd1150be3637e967c99b0bee007216ac03fa512f4412d312a33776069f1f3 |
🚀 Inicio Rápido con Ollama
# 1. Asegúrate de tener Ollama instalado
# https://ollama.com/download
# 2. Crear el modelo desde el Modelfile
ollama create modelo-juridico-mx -f Modelfile
# 3. Ejecutar
ollama run modelo-juridico-mx
# Uso via API de Ollama (Python)
import requests
response = requests.post(
"http://localhost:11434/api/generate",
json={
"model": "modelo-juridico-mx",
"prompt": "¿Qué es el juicio de amparo en México?",
"stream": False
}
)
print(response.json()["response"])
🏋️ Configuración de Inferencia (llama.cpp)
| Parámetro | Valor | Descripción |
|---|---|---|
temperature |
0.3 | Respuestas más deterministas (legal) |
repeat_penalty |
1.15 | Reduce repeticiones |
context_length |
8192 | Ventana de contexto máxima |
num_predict |
2048 | Tokens máximos por respuesta |
top_p |
0.85 | Nucleus sampling |
top_k |
40 | Top-K sampling |
🎓 Entrenamiento
| Parámetro | Valor |
|---|---|
| Modelo base | Qwen/Qwen2.5-7B-Instruct |
| GPU de entrenamiento | Tesla T4 (16 GB VRAM) |
| VRAM utilizada | ~15.6 GB |
| Épocas | 2 |
| Batch size efectivo | 8 (1 × grad_accum 8) |
| Learning rate | 2e-4 |
| LoRA rank | 8 |
| Secuencia máx. | 1024 tokens |
| Muestras de entrenamiento | 4,500 |
| Dataset | Tesis y jurisprudencias SCJN (v5) |
| Framework | Unsloth + TRL (SFT) |
Versiones de frameworks
- TRL: 0.12.0
- Transformers: 4.46.0
- PyTorch: 2.5.0+cu121
- Datasets: 3.1.0
- Tokenizers: 0.20.3
- Unsloth: 2024.11
💡 ¿Qué versión debo elegir?
¿Tienes GPU con 8+ GB VRAM?
├── SÍ → Usa Q4_K_M ⭐ (máximo rendimiento)
└── NO → ¿Tienes GPU con 4–6 GB VRAM?
├── SÍ → Q3_K_M (funcionará bien)
└── NO → ¿Tienes 8+ GB RAM?
├── SÍ → Q4_K_M en CPU (lento pero correcto)
└── NO → Q2_K (mínimo viable)
🔗 Enlaces Útiles
- Repositorio llama.cpp: https://github.com/ggerganov/llama.cpp
- Ollama: https://ollama.com/
- Documentación Unsloth: https://github.com/unslothai/unsloth
- SCJN México: https://www.scjn.gob.mx/
Contacto:
- Correo electrónico: alvaro.ramos.soltero@protonmail.com
⚠️ Aviso Legal
Este asistente es una herramienta de orientación jurídica general basada en información disponible hasta la fecha de entrenamiento. No sustituye la consulta con un abogado certificado. Las respuestas no constituyen asesoría legal profesional. Para situaciones legales específicas, siempre consulta con un profesional del derecho.
📜 Citas
Para citar este modelo:
@misc{asistente-juridico-mx-2025,
title = {{Asistente Jurídico MX: Modelo de Lenguaje para Derecho Mexicano}},
author = {Asistente Jurídico MX Team},
year = 2025,
publisher = {Hugging Face},
url = {https://huggingface.co/tu-usuario/asistente-juridico-mx},
howpublished = {\url{https://huggingface.co/tu-usuario/asistente-juridico-mx}}
}
Frameworks utilizados:
@misc{vonwerra2022trl,
title = {{TRL: Transformer Reinforcement Learning}},
author = {Leandro von Werra and Younes Belkada and Lewis Tunstall and Edward Beeching
and Tristan Thrush and Nathan Lambert and Shengyi Huang and Kashif Rasul
and Quentin Gallouédec},
year = 2020,
journal = {GitHub repository},
publisher = {GitHub},
howpublished = {\url{https://github.com/huggingface/trl}}
}
- Downloads last month
- 31
2-bit
3-bit
4-bit
16-bit