Instructions to use QuantFactory/Faro-Yi-9B-DPO-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use QuantFactory/Faro-Yi-9B-DPO-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="QuantFactory/Faro-Yi-9B-DPO-GGUF", filename="Faro-Yi-9B-DPO.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/Faro-Yi-9B-DPO-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/Faro-Yi-9B-DPO-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf QuantFactory/Faro-Yi-9B-DPO-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/Faro-Yi-9B-DPO-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf QuantFactory/Faro-Yi-9B-DPO-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/Faro-Yi-9B-DPO-GGUF:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf QuantFactory/Faro-Yi-9B-DPO-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/Faro-Yi-9B-DPO-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf QuantFactory/Faro-Yi-9B-DPO-GGUF:Q4_K_M
Use Docker
docker model run hf.co/QuantFactory/Faro-Yi-9B-DPO-GGUF:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use QuantFactory/Faro-Yi-9B-DPO-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "QuantFactory/Faro-Yi-9B-DPO-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/Faro-Yi-9B-DPO-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/QuantFactory/Faro-Yi-9B-DPO-GGUF:Q4_K_M
- Ollama
How to use QuantFactory/Faro-Yi-9B-DPO-GGUF with Ollama:
ollama run hf.co/QuantFactory/Faro-Yi-9B-DPO-GGUF:Q4_K_M
- Unsloth Studio new
How to use QuantFactory/Faro-Yi-9B-DPO-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/Faro-Yi-9B-DPO-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/Faro-Yi-9B-DPO-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/Faro-Yi-9B-DPO-GGUF to start chatting
- Docker Model Runner
How to use QuantFactory/Faro-Yi-9B-DPO-GGUF with Docker Model Runner:
docker model run hf.co/QuantFactory/Faro-Yi-9B-DPO-GGUF:Q4_K_M
- Lemonade
How to use QuantFactory/Faro-Yi-9B-DPO-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull QuantFactory/Faro-Yi-9B-DPO-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.Faro-Yi-9B-DPO-GGUF-Q4_K_M
List all available models
lemonade list
Faro-Yi-9B-DP-GGUF
This is quantized version of wenbopan/Faro-Yi-9B-DPO created using llama.cpp
Model Description
This is the DPO version of wenbopan/Faro-Yi-9B. Compared to Faro-Yi-9B and Yi-9B-200K, the DPO model excels at many tasks, surpassing the original Yi-9B-200K by a large margin. On the Open LLM Leaderboard, it ranks #2 among all 9B models, #1 among all Yi-9B variants.
| Metric | MMLU | GSM8K | hellaswag | truthfulqa | ai2_arc | winogrande | CMMLU |
|---|---|---|---|---|---|---|---|
| Yi-9B-200K | 65.73 | 50.49 | 56.72 | 33.80 | 69.25 | 71.67 | 71.97 |
| Faro-Yi-9B | 68.80 | 63.08 | 57.28 | 40.86 | 72.58 | 71.11 | 73.28 |
| Faro-Yi-9B-DPO | 69.98 | 66.11 | 59.04 | 48.01 | 75.68 | 73.40 | 75.23 |
Faro-Yi-9B-DPO's responses are also favored by GPT-4 Judge in MT-Bench
How to Use
Faro-Yi-9B-DPO uses the chatml template and performs well in both short and long contexts. For longer inputs under 24GB of VRAM, I recommend to use vLLM to have a max prompt of 32K. Setting kv_cache_dtype="fp8_e5m2" allows for 48K input length. 4bit-AWQ quantization on top of that can boost input length to 160K, albeit with some performance impact. Adjust max_model_len arg in vLLM or config.json to avoid OOM.
import io
import requests
from PyPDF2 import PdfReader
from vllm import LLM, SamplingParams
llm = LLM(model="wenbopan/Faro-Yi-9B-DPO", kv_cache_dtype="fp8_e5m2", max_model_len=100000)
pdf_data = io.BytesIO(requests.get("https://arxiv.org/pdf/2303.08774.pdf").content)
document = "".join(page.extract_text() for page in PdfReader(pdf_data).pages) # 100 pages
question = f"{document}\n\nAccording to the paper, what is the parameter count of GPT-4?"
messages = [ {"role": "user", "content": question} ] # 83K tokens
prompt = llm.get_tokenizer().apply_chat_template(messages, add_generation_prompt=True, tokenize=False)
output = llm.generate(prompt, SamplingParams(temperature=0.8, max_tokens=500))
print(output[0].outputs[0].text)
# Yi-9B-200K: 175B. GPT-4 has 175B \nparameters. How many models were combined to create GPT-4? Answer: 6. ...
# Faro-Yi-9B: GPT-4 does not have a publicly disclosed parameter count due to the competitive landscape and safety implications of large-scale models like GPT-4. ...
Or With Transformers
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained('wenbopan/Faro-Yi-9B-DPO', device_map="cuda")
tokenizer = AutoTokenizer.from_pretrained('wenbopan/Faro-Yi-9B-DPO')
messages = [
{"role": "system", "content": "You are a helpful assistant. Always answer with a short response."},
{"role": "user", "content": "Tell me what is Pythagorean theorem like you are a pirate."}
]
input_ids = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt").to(model.device)
generated_ids = model.generate(input_ids, max_new_tokens=512, temperature=0.5)
response = tokenizer.decode(generated_ids[0], skip_special_tokens=True) # Aye, matey! The Pythagorean theorem is a nautical rule that helps us find the length of the third side of a triangle. ...
- Downloads last month
- 598
2-bit
3-bit
4-bit
5-bit
6-bit
8-bit
Model tree for QuantFactory/Faro-Yi-9B-DPO-GGUF
Base model
wenbopan/Faro-Yi-9B-DPO