Instructions to use QuantFactory/Not-WizardLM-2-7B-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use QuantFactory/Not-WizardLM-2-7B-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="QuantFactory/Not-WizardLM-2-7B-GGUF", filename="Not-WizardLM-2-7B.Q2_K.gguf", )
output = llm( "Once upon a time,", max_tokens=512, echo=True ) print(output)
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use QuantFactory/Not-WizardLM-2-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/Not-WizardLM-2-7B-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf QuantFactory/Not-WizardLM-2-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/Not-WizardLM-2-7B-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf QuantFactory/Not-WizardLM-2-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/Not-WizardLM-2-7B-GGUF:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf QuantFactory/Not-WizardLM-2-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/Not-WizardLM-2-7B-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf QuantFactory/Not-WizardLM-2-7B-GGUF:Q4_K_M
Use Docker
docker model run hf.co/QuantFactory/Not-WizardLM-2-7B-GGUF:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use QuantFactory/Not-WizardLM-2-7B-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "QuantFactory/Not-WizardLM-2-7B-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "QuantFactory/Not-WizardLM-2-7B-GGUF", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/QuantFactory/Not-WizardLM-2-7B-GGUF:Q4_K_M
- Ollama
How to use QuantFactory/Not-WizardLM-2-7B-GGUF with Ollama:
ollama run hf.co/QuantFactory/Not-WizardLM-2-7B-GGUF:Q4_K_M
- Unsloth Studio new
How to use QuantFactory/Not-WizardLM-2-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/Not-WizardLM-2-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/Not-WizardLM-2-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/Not-WizardLM-2-7B-GGUF to start chatting
- Docker Model Runner
How to use QuantFactory/Not-WizardLM-2-7B-GGUF with Docker Model Runner:
docker model run hf.co/QuantFactory/Not-WizardLM-2-7B-GGUF:Q4_K_M
- Lemonade
How to use QuantFactory/Not-WizardLM-2-7B-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull QuantFactory/Not-WizardLM-2-7B-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.Not-WizardLM-2-7B-GGUF-Q4_K_M
List all available models
lemonade list
Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model: amazingvince/Not-WizardLM-2-7B
|
| 4 |
+
pipeline_tag: text-generation
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
# QuantFactory/Not-WizardLM-2-7B-GGUF
|
| 8 |
+
This is quantized version of [amazingvince/Not-WizardLM-2-7B]() created using llama.cpp
|
| 9 |
+
|
| 10 |
+
# Model Description
|
| 11 |
+
|
| 12 |
+
<a href="https://colab.research.google.com/gist/pszemraj/d3d74ceab942722b49188606785e2bfd/not-wizardlm-2-7b-inference.ipynb">
|
| 13 |
+
<img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/>
|
| 14 |
+
</a>
|
| 15 |
+
|
| 16 |
+
Included is code ripped from fastchat with the expected chat templating.
|
| 17 |
+
|
| 18 |
+
Also wiz.pdf is a pdf of the github blog showing the apache 2 release.
|
| 19 |
+
Link to wayback machine included: https://web.archive.org/web/20240415221214/https://wizardlm.github.io/WizardLM2/
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
## example
|
| 24 |
+
|
| 25 |
+
```python
|
| 26 |
+
import dataclasses
|
| 27 |
+
from enum import auto, Enum
|
| 28 |
+
from typing import List, Tuple, Any
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
class SeparatorStyle(Enum):
|
| 32 |
+
"""Different separator style."""
|
| 33 |
+
SINGLE = auto()
|
| 34 |
+
TWO = auto()
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
@dataclasses.dataclass
|
| 38 |
+
class Conversation:
|
| 39 |
+
"""A class that keeps all conversation history."""
|
| 40 |
+
system: str
|
| 41 |
+
roles: List[str]
|
| 42 |
+
messages: List[List[str]]
|
| 43 |
+
offset: int
|
| 44 |
+
sep_style: SeparatorStyle = SeparatorStyle.SINGLE
|
| 45 |
+
sep: str = "###"
|
| 46 |
+
sep2: str = None
|
| 47 |
+
|
| 48 |
+
# Used for gradio server
|
| 49 |
+
skip_next: bool = False
|
| 50 |
+
conv_id: Any = None
|
| 51 |
+
|
| 52 |
+
def get_prompt(self):
|
| 53 |
+
if self.sep_style == SeparatorStyle.SINGLE:
|
| 54 |
+
ret = self.system
|
| 55 |
+
for role, message in self.messages:
|
| 56 |
+
if message:
|
| 57 |
+
ret += self.sep + " " + role + ": " + message
|
| 58 |
+
else:
|
| 59 |
+
ret += self.sep + " " + role + ":"
|
| 60 |
+
return ret
|
| 61 |
+
elif self.sep_style == SeparatorStyle.TWO:
|
| 62 |
+
seps = [self.sep, self.sep2]
|
| 63 |
+
ret = self.system + seps[0]
|
| 64 |
+
for i, (role, message) in enumerate(self.messages):
|
| 65 |
+
if message:
|
| 66 |
+
ret += role + ": " + message + seps[i % 2]
|
| 67 |
+
else:
|
| 68 |
+
ret += role + ":"
|
| 69 |
+
return ret
|
| 70 |
+
else:
|
| 71 |
+
raise ValueError(f"Invalid style: {self.sep_style}")
|
| 72 |
+
|
| 73 |
+
def append_message(self, role, message):
|
| 74 |
+
self.messages.append([role, message])
|
| 75 |
+
|
| 76 |
+
def to_gradio_chatbot(self):
|
| 77 |
+
ret = []
|
| 78 |
+
for i, (role, msg) in enumerate(self.messages[self.offset:]):
|
| 79 |
+
if i % 2 == 0:
|
| 80 |
+
ret.append([msg, None])
|
| 81 |
+
else:
|
| 82 |
+
ret[-1][-1] = msg
|
| 83 |
+
return ret
|
| 84 |
+
|
| 85 |
+
def copy(self):
|
| 86 |
+
return Conversation(
|
| 87 |
+
system=self.system,
|
| 88 |
+
roles=self.roles,
|
| 89 |
+
messages=[[x, y] for x, y in self.messages],
|
| 90 |
+
offset=self.offset,
|
| 91 |
+
sep_style=self.sep_style,
|
| 92 |
+
sep=self.sep,
|
| 93 |
+
sep2=self.sep2,
|
| 94 |
+
conv_id=self.conv_id)
|
| 95 |
+
|
| 96 |
+
def dict(self):
|
| 97 |
+
return {
|
| 98 |
+
"system": self.system,
|
| 99 |
+
"roles": self.roles,
|
| 100 |
+
"messages": self.messages,
|
| 101 |
+
"offset": self.offset,
|
| 102 |
+
"sep": self.sep,
|
| 103 |
+
"sep2": self.sep2,
|
| 104 |
+
"conv_id": self.conv_id,
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
conv = Conversation(
|
| 110 |
+
system="A chat between a curious user and an artificial intelligence assistant. "
|
| 111 |
+
"The assistant gives helpful, detailed, and polite answers to the user's questions.",
|
| 112 |
+
roles=("USER", "ASSISTANT"),
|
| 113 |
+
messages=[],
|
| 114 |
+
offset=0,
|
| 115 |
+
sep_style=SeparatorStyle.TWO,
|
| 116 |
+
sep=" ",
|
| 117 |
+
sep2="</s>",
|
| 118 |
+
)
|
| 119 |
+
|
| 120 |
+
conv.append_message(conv.roles[0], "Why would Microsoft take this down?")
|
| 121 |
+
conv.append_message(conv.roles[1], None)
|
| 122 |
+
prompt = conv.get_prompt()
|
| 123 |
+
|
| 124 |
+
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
| 125 |
+
|
| 126 |
+
result = model.generate(**inputs, max_new_tokens=1000)
|
| 127 |
+
generated_ids = result[0]
|
| 128 |
+
generated_text = tokenizer.decode(generated_ids, skip_special_tokens=True)
|
| 129 |
+
print(generated_text)
|
| 130 |
+
|
| 131 |
+
```
|