|
Download docs/llama_cpp_integration.md from Ian26/MarsLM: direct link, hf CLI and curl.
- Browser
- Download file 2.57 kB
-
https://huggingface.co/Ian26/MarsLM/resolve/main/docs/llama_cpp_integration.md
- Command line
-
hf download hf://Ian26/MarsLM/docs/llama_cpp_integration.md
-
curl -L -o llama_cpp_integration.md https://huggingface.co/Ian26/MarsLM/resolve/main/docs/llama_cpp_integration.md
2.57 kB
| # Ejecuci贸n con llama.cpp | |
| Este documento describe c贸mo preparar un modelo MarsLM para ejecutar con llama.cpp. | |
| ## 1. Requisitos | |
| - `llama.cpp` compilado en Windows. | |
| - `python` instalado. | |
| - Un checkpoint de MarsLM entrenado en `artifacts/checkpoints/marslm-final.pt`. | |
| - Un tokenizador compatible: `artifacts/tokenizer/marslm.json`. | |
| ## 2. Exportar a GGUF | |
| Si deseas una exportaci贸n de metadatos GGUF para integraci贸n con llama.cpp / Ollama, usa: | |
| ```powershell | |
| python quantization/export_gguf.py --model-path artifacts/checkpoints/marslm-final.pt --config artifacts/checkpoints/config.json --output artifacts/quantized/marslm --quant-type gguf --output-format gguf | |
| ``` | |
| Esto escribir谩 un stub GGUF en `artifacts/quantized/marslm.gguf`. | |
| ## 3. Exportar pesos INT8 / INT4 | |
| El script tambi茅n produce payloads cuantizados. | |
| INT8: | |
| ```powershell | |
| python quantization/export_gguf.py --model-path artifacts/checkpoints/marslm-final.pt --config artifacts/checkpoints/config.json --output artifacts/quantized/marslm_int8 --quant-type int8 --output-format pt | |
| ``` | |
| INT4 (base para Q4/Q5): | |
| ```powershell | |
| python quantization/export_gguf.py --model-path artifacts/checkpoints/marslm-final.pt --config artifacts/checkpoints/config.json --output artifacts/quantized/marslm_int4 --quant-type int4 --output-format pt | |
| ``` | |
| Q4/Q5 stub: | |
| ```powershell | |
| python quantization/export_gguf.py --model-path artifacts/checkpoints/marslm-final.pt --config artifacts/checkpoints/config.json --output artifacts/quantized/marslm_q4_1 --quant-type q4_1 --output-format gguf | |
| ``` | |
| ## 4. Uso con llama.cpp | |
| Una vez que tengas los pesos cuantizados y el stub GGUF, usa el comando de `llama.cpp` para cargar el modelo. | |
| ```powershell | |
| .in | |
| eleasein ext-generation.exe ^ | |
| --model artifacts\quantized\marslm_q4_1.gguf ^ | |
| --prompt "Hola, escribe un poema corto en espa帽ol." ^ | |
| --n_predict 128 | |
| ``` | |
| > Nota: esta gu铆a asume que `llama.cpp` puede aceptar el stub GGUF y los pesos en el formato generado. Si `llama.cpp` requiere un conversor adicional, usa `python export/export.py --format gguf` o un conversor de terceros para crear el archivo final compatible. | |
| ## 5. Observaciones | |
| - La cuantizaci贸n INT4 aqu铆 es una aproximaci贸n de carga y requiere un convertidor espec铆fico si quieres un `.gguf` plenamente compatible. | |
| - Para peso real Q4/Q5, llama.cpp generalmente usa conversores binarios especializados que ajustan la representaci贸n de las matrices. | |
| - Usa el stub GGUF como base de integraci贸n cuando no exista un convertidor directo. | |