Instructions to use QuantFactory/SuperCorrect-7B-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use QuantFactory/SuperCorrect-7B-GGUF with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("question-answering", model="QuantFactory/SuperCorrect-7B-GGUF") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("QuantFactory/SuperCorrect-7B-GGUF", dtype="auto") - llama-cpp-python
How to use QuantFactory/SuperCorrect-7B-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="QuantFactory/SuperCorrect-7B-GGUF", filename="SuperCorrect-7B.Q2_K.gguf", )
llm.create_chat_completion( messages = "{\n \"question\": \"What is my name?\",\n \"context\": \"My name is Clara and I live in Berkeley.\"\n}" ) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use QuantFactory/SuperCorrect-7B-GGUF with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf QuantFactory/SuperCorrect-7B-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf QuantFactory/SuperCorrect-7B-GGUF:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf QuantFactory/SuperCorrect-7B-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf QuantFactory/SuperCorrect-7B-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/SuperCorrect-7B-GGUF:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf QuantFactory/SuperCorrect-7B-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/SuperCorrect-7B-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf QuantFactory/SuperCorrect-7B-GGUF:Q4_K_M
Use Docker
docker model run hf.co/QuantFactory/SuperCorrect-7B-GGUF:Q4_K_M
- LM Studio
- Jan
- Ollama
How to use QuantFactory/SuperCorrect-7B-GGUF with Ollama:
ollama run hf.co/QuantFactory/SuperCorrect-7B-GGUF:Q4_K_M
- Unsloth Studio
How to use QuantFactory/SuperCorrect-7B-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/SuperCorrect-7B-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/SuperCorrect-7B-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/SuperCorrect-7B-GGUF to start chatting
- Pi
How to use QuantFactory/SuperCorrect-7B-GGUF with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf QuantFactory/SuperCorrect-7B-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/SuperCorrect-7B-GGUF:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use QuantFactory/SuperCorrect-7B-GGUF with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf QuantFactory/SuperCorrect-7B-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/SuperCorrect-7B-GGUF:Q4_K_M
Run Hermes
hermes
- Docker Model Runner
How to use QuantFactory/SuperCorrect-7B-GGUF with Docker Model Runner:
docker model run hf.co/QuantFactory/SuperCorrect-7B-GGUF:Q4_K_M
- Lemonade
How to use QuantFactory/SuperCorrect-7B-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull QuantFactory/SuperCorrect-7B-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.SuperCorrect-7B-GGUF-Q4_K_M
List all available models
lemonade list
Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
---
|
| 3 |
+
|
| 4 |
+
license: apache-2.0
|
| 5 |
+
language:
|
| 6 |
+
- en
|
| 7 |
+
metrics:
|
| 8 |
+
- accuracy
|
| 9 |
+
base_model:
|
| 10 |
+
- Qwen/Qwen2.5-Math-7B-Instruct
|
| 11 |
+
library_name: transformers
|
| 12 |
+
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
[](https://hf.co/QuantFactory)
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
# QuantFactory/SuperCorrect-7B-GGUF
|
| 19 |
+
This is quantized version of [BitStarWalkin/SuperCorrect-7B](https://huggingface.co/BitStarWalkin/SuperCorrect-7B) created using llama.cpp
|
| 20 |
+
|
| 21 |
+
# Original Model Card
|
| 22 |
+
|
| 23 |
+
## SuperCorrect: Supervising and Correcting Language Models with Error-Driven Insights
|
| 24 |
+
|
| 25 |
+
> [SuperCorrect: Supervising and Correcting Language Models with Error-Driven Insights](link)
|
| 26 |
+
> [Ling Yang\*](https://yangling0818.github.io/), [Zhaochen Yu*](https://github.com/BitCodingWalkin), [Tianjun Zhang](https://tianjunz.github.io/), [Minkai Xu](https://minkaixu.com/), [Joseph E. Gonzalez](https://people.eecs.berkeley.edu/~jegonzal/),[Bin Cui](https://cuibinpku.github.io/), [Shuicheng Yan](https://yanshuicheng.info/)
|
| 27 |
+
>
|
| 28 |
+
> Peking University, Skywork AI, UC Berkeley, Stanford University
|
| 29 |
+
|
| 30 |
+
<p align="left">
|
| 31 |
+
<a href='https://arxiv.org/abs/2410.09008'>
|
| 32 |
+
<img src='https://img.shields.io/badge/Arxiv-2410.09008-A42C25?style=flat&logo=arXiv&logoColor=A42C25'></a>
|
| 33 |
+
</p>
|
| 34 |
+
|
| 35 |
+
## Introduction
|
| 36 |
+
|
| 37 |
+

|
| 38 |
+
|
| 39 |
+
This repo provides the official implementation of **SuperCorrect** a novel two-stage fine-tuning method for improving both reasoning accuracy and self-correction ability for LLMs.
|
| 40 |
+
|
| 41 |
+
Notably, our **SupperCorrect-7B** model significantly surpasses powerful **DeepSeekMath-7B by 7.8%/5.3% and Qwen2.5-Math-7B by 15.1%/6.3% on MATH/GSM8K benchmarks**, achieving new SOTA performance among all 7B models.
|
| 42 |
+
|
| 43 |
+
<div align="left">
|
| 44 |
+
馃毃 Unlike other LLMs, we incorporate LLMs with our pre-defined hierarchical thought template ([Buffer of Thought (BoT)](https://github.com/YangLing0818/buffer-of-thought-llm)) to conduct more deliberate reasoning than conventional CoT. It should be noted that our evaluation methods relies on pure mathematical reasoning abilities of LLMs, instead of leverage other programming methods such as PoT and ToRA.
|
| 45 |
+
</div>
|
| 46 |
+
|
| 47 |
+
## Examples
|
| 48 |
+
|
| 49 |
+

|
| 50 |
+
|
| 51 |
+
<div align="left">
|
| 52 |
+
<b>
|
| 53 |
+
馃毃 For more concise and clear presentation, we omit some XML tags.
|
| 54 |
+
</b>
|
| 55 |
+
</div>
|
| 56 |
+
|
| 57 |
+
### Model details
|
| 58 |
+
*You can check our [Github repo](https://github.com/YangLing0818/SuperCorrect-llm) for more details.*
|
| 59 |
+
|
| 60 |
+
## Quick Start
|
| 61 |
+
|
| 62 |
+
### Requirements
|
| 63 |
+
|
| 64 |
+
* Since our current model is based on Qwen2.5-Math series, `transformers>=4.37.0` is needed for Qwen2.5-Math models. The latest version is recommended.
|
| 65 |
+
|
| 66 |
+
> [!Warning]
|
| 67 |
+
>
|
| 68 |
+
> <div align="center">
|
| 69 |
+
> <b>
|
| 70 |
+
> 馃毃 This is a must because `transformers` integrated Qwen2 codes since `4.37.0`.
|
| 71 |
+
> </b>
|
| 72 |
+
> </div>
|
| 73 |
+
|
| 74 |
+
### Inference
|
| 75 |
+
|
| 76 |
+
#### 馃 Hugging Face Transformers
|
| 77 |
+
|
| 78 |
+
```python
|
| 79 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 80 |
+
|
| 81 |
+
model_name = "BitStarWalkin/SuperCorrect-7B"
|
| 82 |
+
device = "cuda"
|
| 83 |
+
|
| 84 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 85 |
+
model_name,
|
| 86 |
+
torch_dtype="auto",
|
| 87 |
+
device_map="auto"
|
| 88 |
+
)
|
| 89 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 90 |
+
|
| 91 |
+
prompt = "Find the distance between the foci of the ellipse \[9x^2 + \frac{y^2}{9} = 99.\]"
|
| 92 |
+
hierarchical_prompt = "Solve the following math problem in a step-by-step XML format, each step should be enclosed within tags like <Step1></Step1>. For each step enclosed within the tags, determine if this step is challenging and tricky, if so, add detailed explanation and analysis enclosed within <Key> </Key> in this step, as helpful annotations to help you thinking and remind yourself how to conduct reasoning correctly. After all the reasoning steps, summarize the common solution and reasoning steps to help you and your classmates who are not good at math generalize to similar problems within <Generalized></Generalized>. Finally present the final answer within <Answer> </Answer>."
|
| 93 |
+
# HT
|
| 94 |
+
messages = [
|
| 95 |
+
{"role": "system", "content":hierarchical_prompt },
|
| 96 |
+
{"role": "user", "content": prompt}
|
| 97 |
+
]
|
| 98 |
+
|
| 99 |
+
text = tokenizer.apply_chat_template(
|
| 100 |
+
messages,
|
| 101 |
+
tokenize=False,
|
| 102 |
+
add_generation_prompt=True
|
| 103 |
+
)
|
| 104 |
+
model_inputs = tokenizer([text], return_tensors="pt").to(device)
|
| 105 |
+
|
| 106 |
+
generated_ids = model.generate(
|
| 107 |
+
**model_inputs,
|
| 108 |
+
max_new_tokens=1024
|
| 109 |
+
)
|
| 110 |
+
generated_ids = [
|
| 111 |
+
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
|
| 112 |
+
]
|
| 113 |
+
|
| 114 |
+
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
| 115 |
+
print(response)
|
| 116 |
+
```
|
| 117 |
+
|
| 118 |
+
## Performance
|
| 119 |
+
|
| 120 |
+
We evaluate our SupperCorrect-7B on two widely used English math benchmarks GSM8K and MATH. All evaluations are tested with our evaluation method which is zero-shot hierarchical thought based prompting.
|
| 121 |
+
|
| 122 |
+

|
| 123 |
+
|
| 124 |
+
## Citation
|
| 125 |
+
|
| 126 |
+
```bash
|
| 127 |
+
@article{yang2024supercorrect,
|
| 128 |
+
title={SuperCorrect: Supervising and Correcting Language Models with Error-Driven Insights}
|
| 129 |
+
author={Yang, Ling and Yu, Zhaochen and Zhang, Tianjun and Xu, Minkai and Gonzalez, Joseph E and Cui, Bin and Yan, Shuicheng},
|
| 130 |
+
journal={arXiv preprint arXiv:2410.09008},
|
| 131 |
+
year={2024}
|
| 132 |
+
}
|
| 133 |
+
@article{yang2024buffer,
|
| 134 |
+
title={Buffer of Thoughts: Thought-Augmented Reasoning with Large Language Models},
|
| 135 |
+
author={Yang, Ling and Yu, Zhaochen and Zhang, Tianjun and Cao, Shiyi and Xu, Minkai and Zhang, Wentao and Gonzalez, Joseph E and Cui, Bin},
|
| 136 |
+
journal={arXiv preprint arXiv:2406.04271},
|
| 137 |
+
year={2024}
|
| 138 |
+
}
|
| 139 |
+
```
|
| 140 |
+
|
| 141 |
+
## Acknowledgements
|
| 142 |
+
|
| 143 |
+
Our SuperCorrect is a two-stage fine-tuning model which based on several extraordinary open-source models like [Qwen2.5-Math](https://github.com/QwenLM/Qwen2.5-Math), [DeepSeek-Math](https://github.com/deepseek-ai/DeepSeek-Math), [Llama3-Series](https://github.com/meta-llama/llama3). Our evaluation method is based on the code base of outstanding works like [Qwen2.5-Math](https://github.com/QwenLM/Qwen2.5-Math) and [lm-evaluation-harness](https://github.com/EleutherAI/lm-evaluation-harness). We also want to express our gratitude for amazing works such as [BoT](https://github.com/YangLing0818/buffer-of-thought-llm) which provides the idea of thought template.
|