Instructions to use QuantFactory/Nxcode-CQ-7B-orpo-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use QuantFactory/Nxcode-CQ-7B-orpo-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="QuantFactory/Nxcode-CQ-7B-orpo-GGUF", filename="Nxcode-CQ-7B-orpo.Q2_K.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 QuantFactory/Nxcode-CQ-7B-orpo-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/Nxcode-CQ-7B-orpo-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf QuantFactory/Nxcode-CQ-7B-orpo-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/Nxcode-CQ-7B-orpo-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf QuantFactory/Nxcode-CQ-7B-orpo-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/Nxcode-CQ-7B-orpo-GGUF:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf QuantFactory/Nxcode-CQ-7B-orpo-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/Nxcode-CQ-7B-orpo-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf QuantFactory/Nxcode-CQ-7B-orpo-GGUF:Q4_K_M
Use Docker
docker model run hf.co/QuantFactory/Nxcode-CQ-7B-orpo-GGUF:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use QuantFactory/Nxcode-CQ-7B-orpo-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "QuantFactory/Nxcode-CQ-7B-orpo-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "QuantFactory/Nxcode-CQ-7B-orpo-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/QuantFactory/Nxcode-CQ-7B-orpo-GGUF:Q4_K_M
- Ollama
How to use QuantFactory/Nxcode-CQ-7B-orpo-GGUF with Ollama:
ollama run hf.co/QuantFactory/Nxcode-CQ-7B-orpo-GGUF:Q4_K_M
- Unsloth Studio new
How to use QuantFactory/Nxcode-CQ-7B-orpo-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/Nxcode-CQ-7B-orpo-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/Nxcode-CQ-7B-orpo-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/Nxcode-CQ-7B-orpo-GGUF to start chatting
- Docker Model Runner
How to use QuantFactory/Nxcode-CQ-7B-orpo-GGUF with Docker Model Runner:
docker model run hf.co/QuantFactory/Nxcode-CQ-7B-orpo-GGUF:Q4_K_M
- Lemonade
How to use QuantFactory/Nxcode-CQ-7B-orpo-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull QuantFactory/Nxcode-CQ-7B-orpo-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.Nxcode-CQ-7B-orpo-GGUF-Q4_K_M
List all available models
lemonade list
Install from WinGet (Windows)
winget install llama.cpp
# Start a local OpenAI-compatible server with a web UI:
llama-server -hf QuantFactory/Nxcode-CQ-7B-orpo-GGUF:# Run inference directly in the terminal:
llama-cli -hf QuantFactory/Nxcode-CQ-7B-orpo-GGUF: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/Nxcode-CQ-7B-orpo-GGUF:# Run inference directly in the terminal:
./llama-cli -hf QuantFactory/Nxcode-CQ-7B-orpo-GGUF: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/Nxcode-CQ-7B-orpo-GGUF:# Run inference directly in the terminal:
./build/bin/llama-cli -hf QuantFactory/Nxcode-CQ-7B-orpo-GGUF:Use Docker
docker model run hf.co/QuantFactory/Nxcode-CQ-7B-orpo-GGUF:QuantFactory/Nxcode-CQ-7B-orpo-GGUF
This is quantized version of NTQAI/Nxcode-CQ-7B-orpo created suing llama.cpp
Model Description
Nxcode-CQ-7B-orpo is an Monolithic Preference Optimization without Reference Model fine-tune of Qwen/CodeQwen1.5-7B on 100k samples of high-quality ranking data.
Evalplus
| EvalPlus | pass@1 |
|---|---|
| HumanEval | 86.6 |
| HumanEval+ | 83.5 |
| MBPP(v0.2.0) | 82.3 |
| MBPP+(v0.2.0) | 70.4 |
We use a simple template to generate the solution for evalplus:
"Complete the following Python function:\n{prompt}"
| Models | HumanEval | HumanEval+ |
|---|---|---|
| GPT-4-Turbo (April 2024) | 90.2 | 86.6 |
| GPT-4 (May 2023) | 88.4 | 81.17 |
| GPT-4-Turbo (Nov 2023) | 85.4 | 79.3 |
| CodeQwen1.5-7B-Chat | 83.5 | 78.7 |
| claude-3-opus (Mar 2024) | 82.9 | 76.8 |
| DeepSeek-Coder-33B-instruct | 81.1 | 75.0 |
| WizardCoder-33B-V1.1 | 79.9 | 73.2 |
| OpenCodeInterpreter-DS-33B | 79.3 | 73.8 |
| speechless-codellama-34B-v2.0 | 77.4 | 72 |
| GPT-3.5-Turbo (Nov 2023) | 76.8 | 70.7 |
| Llama3-70B-instruct | 76.2 | 70.7 |
Bigcode Leaderboard
09/05/2024
Top 1 average score.
Top 2 winrate.
Quickstart
Here provides a code snippet with apply_chat_template to show you how to load the tokenizer and model and how to generate contents. You should upgrade the transformers if you receive an error when loading the tokenizer
from transformers import AutoModelForCausalLM, AutoTokenizer
device = "cuda" # the device to load the model onto
model = AutoModelForCausalLM.from_pretrained(
"NTQAI/Nxcode-CQ-7B-orpo",
torch_dtype="auto",
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained("NTQAI/Nxcode-CQ-7B-orpo")
prompt = """Complete the following Python function:
from typing import List
def has_close_elements(numbers: List[float], threshold: float) -> bool:
""" Check if in given list of numbers, are any two numbers closer to each other than
given threshold.
>>> has_close_elements([1.0, 2.0, 3.0], 0.5)
False
>>> has_close_elements([1.0, 2.8, 3.0, 4.0, 5.0, 2.0], 0.3)
True
"""
"""
messages = [
{"role": "user", "content": prompt}
]
inputs = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to(model.device)
outputs = model.generate(inputs, max_new_tokens=512, do_sample=False, top_k=50, top_p=0.95, num_return_sequences=1, eos_token_id=tokenizer.eos_token_id)
res = tokenizer.decode(outputs[0][len(inputs[0]):], skip_special_tokens=True)
- Downloads last month
- 144
2-bit
3-bit
4-bit
5-bit
6-bit
8-bit
Model tree for QuantFactory/Nxcode-CQ-7B-orpo-GGUF
Base model
NTQAI/Nxcode-CQ-7B-orpo
Install from brew
# Start a local OpenAI-compatible server with a web UI: llama-server -hf QuantFactory/Nxcode-CQ-7B-orpo-GGUF:# Run inference directly in the terminal: llama-cli -hf QuantFactory/Nxcode-CQ-7B-orpo-GGUF: