Instructions to use QuantFactory/OpenMath2-Llama3.1-8B-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use QuantFactory/OpenMath2-Llama3.1-8B-GGUF with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf QuantFactory/OpenMath2-Llama3.1-8B-GGUF:Q4_K_M # Run inference directly in the terminal: llama cli -hf QuantFactory/OpenMath2-Llama3.1-8B-GGUF:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf QuantFactory/OpenMath2-Llama3.1-8B-GGUF:Q4_K_M # Run inference directly in the terminal: llama cli -hf QuantFactory/OpenMath2-Llama3.1-8B-GGUF: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 QuantFactory/OpenMath2-Llama3.1-8B-GGUF:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf QuantFactory/OpenMath2-Llama3.1-8B-GGUF: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 QuantFactory/OpenMath2-Llama3.1-8B-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf QuantFactory/OpenMath2-Llama3.1-8B-GGUF:Q4_K_M
Use Docker
docker model run hf.co/QuantFactory/OpenMath2-Llama3.1-8B-GGUF:Q4_K_M
- LM Studio
- Jan
- Ollama
How to use QuantFactory/OpenMath2-Llama3.1-8B-GGUF with Ollama:
ollama run hf.co/QuantFactory/OpenMath2-Llama3.1-8B-GGUF:Q4_K_M
- Unsloth Studio
How to use QuantFactory/OpenMath2-Llama3.1-8B-GGUF 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 QuantFactory/OpenMath2-Llama3.1-8B-GGUF 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 QuantFactory/OpenMath2-Llama3.1-8B-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for QuantFactory/OpenMath2-Llama3.1-8B-GGUF to start chatting
- Pi
How to use QuantFactory/OpenMath2-Llama3.1-8B-GGUF with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf QuantFactory/OpenMath2-Llama3.1-8B-GGUF: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": "QuantFactory/OpenMath2-Llama3.1-8B-GGUF:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use QuantFactory/OpenMath2-Llama3.1-8B-GGUF with Docker Model Runner:
docker model run hf.co/QuantFactory/OpenMath2-Llama3.1-8B-GGUF:Q4_K_M
- Lemonade
How to use QuantFactory/OpenMath2-Llama3.1-8B-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull QuantFactory/OpenMath2-Llama3.1-8B-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.OpenMath2-Llama3.1-8B-GGUF-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use QuantFactory/OpenMath2-Llama3.1-8B-GGUF with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf QuantFactory/OpenMath2-Llama3.1-8B-GGUF: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 QuantFactory/OpenMath2-Llama3.1-8B-GGUF:Q4_K_M
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use QuantFactory/OpenMath2-Llama3.1-8B-GGUF with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf QuantFactory/OpenMath2-Llama3.1-8B-GGUF:Q4_K_M
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "QuantFactory/OpenMath2-Llama3.1-8B-GGUF:Q4_K_M" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
---
|
| 3 |
+
|
| 4 |
+
license: llama3.1
|
| 5 |
+
base_model:
|
| 6 |
+
- meta-llama/Llama-3.1-8B
|
| 7 |
+
datasets:
|
| 8 |
+
- nvidia/OpenMathInstruct-2
|
| 9 |
+
language:
|
| 10 |
+
- en
|
| 11 |
+
tags:
|
| 12 |
+
- nvidia
|
| 13 |
+
- math
|
| 14 |
+
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
[](https://hf.co/QuantFactory)
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
# QuantFactory/OpenMath2-Llama3.1-8B-GGUF
|
| 21 |
+
This is quantized version of [nvidia/OpenMath2-Llama3.1-8B](https://huggingface.co/nvidia/OpenMath2-Llama3.1-8B) created using llama.cpp
|
| 22 |
+
|
| 23 |
+
# Original Model Card
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
# OpenMath2-Llama3.1-8B
|
| 27 |
+
|
| 28 |
+
OpenMath2-Llama3.1-8B is obtained by finetuning [Llama3.1-8B-Base](https://huggingface.co/meta-llama/Llama-3.1-8B) with [OpenMathInstruct-2](https://huggingface.co/datasets/nvidia/OpenMathInstruct-2).
|
| 29 |
+
|
| 30 |
+
The model outperforms [Llama3.1-8B-Instruct](https://huggingface.co/meta-llama/Llama-3.1-8B-Instruct) on all the popular math benchmarks we evaluate on, especially on [MATH](https://github.com/hendrycks/math) by 15.9%.
|
| 31 |
+
|
| 32 |
+
<!-- <p align="center">
|
| 33 |
+
<img src="scaling_plot.jpg" width="350"><img src="math_level_comp.jpg" width="350">
|
| 34 |
+
</p> -->
|
| 35 |
+
|
| 36 |
+
<style>
|
| 37 |
+
.image-container {
|
| 38 |
+
display: flex;
|
| 39 |
+
justify-content: center;
|
| 40 |
+
align-items: center;
|
| 41 |
+
gap: 20px;
|
| 42 |
+
}
|
| 43 |
+
.image-container img {
|
| 44 |
+
width: 350px;
|
| 45 |
+
height: auto;
|
| 46 |
+
}
|
| 47 |
+
</style>
|
| 48 |
+
|
| 49 |
+
<div class="image-container">
|
| 50 |
+
<img src="scaling_plot.jpg" title="Performance of Llama-3.1-8B-Instruct as it is trained on increasing proportions of OpenMathInstruct-2">
|
| 51 |
+
<img src="math_level_comp.jpg" title="Comparison of OpenMath2-Llama3.1-8B vs. Llama-3.1-8B-Instruct across MATH levels">
|
| 52 |
+
</div>
|
| 53 |
+
|
| 54 |
+
| Model | GSM8K | MATH | AMC 2023 | AIME 2024 | Omni-MATH |
|
| 55 |
+
|:---|:---:|:---:|:---:|:---:|:---:|
|
| 56 |
+
| Llama3.1-8B-Instruct | 84.5 | 51.9 | 9/40 | 2/30 | 12.7 |
|
| 57 |
+
| **OpenMath2-Llama3.1-8B** ([nemo](https://huggingface.co/nvidia/OpenMath2-Llama3.1-8B-nemo) \| [HF](https://huggingface.co/nvidia/OpenMath2-Llama3.1-8B)) | 91.7 | 67.8 | 16/40 | 3/30 | 22.0 |
|
| 58 |
+
| + majority@256 | 94.1 | 76.1 | 23/40 | 3/30 | 24.6 |
|
| 59 |
+
| Llama3.1-70B-Instruct | 95.8 | 67.9 | 19/40 | 6/30 | 19.0 |
|
| 60 |
+
| OpenMath2-Llama3.1-70B ([nemo](https://huggingface.co/nvidia/OpenMath2-Llama3.1-70B-nemo) \| [HF](https://huggingface.co/nvidia/OpenMath2-Llama3.1-70B)) | 94.9 | 71.9 | 20/40 | 4/30 | 23.1 |
|
| 61 |
+
| + majority@256 | 96.0 | 79.6 | 24/40 | 6/30 | 27.6 |
|
| 62 |
+
|
| 63 |
+
The pipeline we used to produce the data and models is fully open-sourced!
|
| 64 |
+
|
| 65 |
+
- [Code](https://github.com/Kipok/NeMo-Skills)
|
| 66 |
+
- [Models](https://huggingface.co/collections/nvidia/openmath-2-66fb142317d86400783d2c7b)
|
| 67 |
+
- [Dataset](https://huggingface.co/datasets/nvidia/OpenMathInstruct-2)
|
| 68 |
+
|
| 69 |
+
See our [paper](https://arxiv.org/abs/2410.01560) to learn more details!
|
| 70 |
+
|
| 71 |
+
# How to use the models?
|
| 72 |
+
|
| 73 |
+
Our models are trained with the same "chat format" as Llama3.1-instruct models (same system/user/assistant tokens).
|
| 74 |
+
Please note that these models have not been instruction tuned on general data and thus might not provide good answers outside of math domain.
|
| 75 |
+
|
| 76 |
+
We recommend using [instructions in our repo](https://github.com/Kipok/NeMo-Skills/blob/main/docs/inference.md) to run inference with these models, but here is
|
| 77 |
+
an example of how to do it through transformers api:
|
| 78 |
+
|
| 79 |
+
```python
|
| 80 |
+
import transformers
|
| 81 |
+
import torch
|
| 82 |
+
|
| 83 |
+
model_id = "nvidia/OpenMath2-Llama3.1-8B"
|
| 84 |
+
|
| 85 |
+
pipeline = transformers.pipeline(
|
| 86 |
+
"text-generation",
|
| 87 |
+
model=model_id,
|
| 88 |
+
model_kwargs={"torch_dtype": torch.bfloat16},
|
| 89 |
+
device_map="auto",
|
| 90 |
+
)
|
| 91 |
+
|
| 92 |
+
messages = [
|
| 93 |
+
{
|
| 94 |
+
"role": "user",
|
| 95 |
+
"content": "Solve the following math problem. Make sure to put the answer (and only answer) inside \\boxed{}.\n\n" +
|
| 96 |
+
"What is the minimum value of $a^2+6a-7$?"},
|
| 97 |
+
]
|
| 98 |
+
|
| 99 |
+
outputs = pipeline(
|
| 100 |
+
messages,
|
| 101 |
+
max_new_tokens=4096,
|
| 102 |
+
)
|
| 103 |
+
print(outputs[0]["generated_text"][-1]['content'])
|
| 104 |
+
```
|
| 105 |
+
|
| 106 |
+
# Reproducing our results
|
| 107 |
+
|
| 108 |
+
We provide [all instructions](https://github.com/Kipok/NeMo-Skills/blob/main/docs/reproducing-results.md) to fully reproduce our results.
|
| 109 |
+
|
| 110 |
+
## Citation
|
| 111 |
+
|
| 112 |
+
If you find our work useful, please consider citing us!
|
| 113 |
+
|
| 114 |
+
```bibtex
|
| 115 |
+
@article{toshniwal2024openmath2,
|
| 116 |
+
title = {OpenMathInstruct-2: Accelerating AI for Math with Massive Open-Source Instruction Data},
|
| 117 |
+
author = {Shubham Toshniwal and Wei Du and Ivan Moshkov and Branislav Kisacanin and Alexan Ayrapetyan and Igor Gitman},
|
| 118 |
+
year = {2024},
|
| 119 |
+
journal = {arXiv preprint arXiv:2410.01560}
|
| 120 |
+
}
|
| 121 |
+
```
|
| 122 |
+
|
| 123 |
+
## Terms of use
|
| 124 |
+
|
| 125 |
+
By accessing this model, you are agreeing to the LLama 3.1 terms and conditions of the [license](https://github.com/meta-llama/llama-models/blob/main/models/llama3_1/LICENSE), [acceptable use policy](https://github.com/meta-llama/llama-models/blob/main/models/llama3_1/USE_POLICY.md) and [Meta’s privacy policy](https://www.facebook.com/privacy/policy/)
|
| 126 |
+
|