Instructions to use QuantFactory/karakuri-lm-7b-apm-v0.2-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use QuantFactory/karakuri-lm-7b-apm-v0.2-GGUF with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="QuantFactory/karakuri-lm-7b-apm-v0.2-GGUF") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("QuantFactory/karakuri-lm-7b-apm-v0.2-GGUF", dtype="auto") - llama-cpp-python
How to use QuantFactory/karakuri-lm-7b-apm-v0.2-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="QuantFactory/karakuri-lm-7b-apm-v0.2-GGUF", filename="karakuri-lm-7b-apm-v0.2.Q2_K.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use QuantFactory/karakuri-lm-7b-apm-v0.2-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/karakuri-lm-7b-apm-v0.2-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf QuantFactory/karakuri-lm-7b-apm-v0.2-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/karakuri-lm-7b-apm-v0.2-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf QuantFactory/karakuri-lm-7b-apm-v0.2-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/karakuri-lm-7b-apm-v0.2-GGUF:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf QuantFactory/karakuri-lm-7b-apm-v0.2-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/karakuri-lm-7b-apm-v0.2-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf QuantFactory/karakuri-lm-7b-apm-v0.2-GGUF:Q4_K_M
Use Docker
docker model run hf.co/QuantFactory/karakuri-lm-7b-apm-v0.2-GGUF:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use QuantFactory/karakuri-lm-7b-apm-v0.2-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "QuantFactory/karakuri-lm-7b-apm-v0.2-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/karakuri-lm-7b-apm-v0.2-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/QuantFactory/karakuri-lm-7b-apm-v0.2-GGUF:Q4_K_M
- SGLang
How to use QuantFactory/karakuri-lm-7b-apm-v0.2-GGUF with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "QuantFactory/karakuri-lm-7b-apm-v0.2-GGUF" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "QuantFactory/karakuri-lm-7b-apm-v0.2-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "QuantFactory/karakuri-lm-7b-apm-v0.2-GGUF" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "QuantFactory/karakuri-lm-7b-apm-v0.2-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use QuantFactory/karakuri-lm-7b-apm-v0.2-GGUF with Ollama:
ollama run hf.co/QuantFactory/karakuri-lm-7b-apm-v0.2-GGUF:Q4_K_M
- Unsloth Studio
How to use QuantFactory/karakuri-lm-7b-apm-v0.2-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/karakuri-lm-7b-apm-v0.2-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/karakuri-lm-7b-apm-v0.2-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/karakuri-lm-7b-apm-v0.2-GGUF to start chatting
- Atomic Chat new
- Docker Model Runner
How to use QuantFactory/karakuri-lm-7b-apm-v0.2-GGUF with Docker Model Runner:
docker model run hf.co/QuantFactory/karakuri-lm-7b-apm-v0.2-GGUF:Q4_K_M
- Lemonade
How to use QuantFactory/karakuri-lm-7b-apm-v0.2-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull QuantFactory/karakuri-lm-7b-apm-v0.2-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.karakuri-lm-7b-apm-v0.2-GGUF-Q4_K_M
List all available models
lemonade list
Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
- steerlm
|
| 13 |
+
base_model: karakuri-ai/karakuri-lm-7b-apm-v0.2
|
| 14 |
+
pipeline_tag: text-generation
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
# KARAKURI LM 7B APM v0.2- GGUF
|
| 18 |
+
This is quantized version of [karakuri-ai/karakuri-lm-7b-apm-v0.2](https://huggingface.co/karakuri-ai/karakuri-lm-7b-apm-v0.2) created using llama.cpp
|
| 19 |
+
|
| 20 |
+
## Model Details
|
| 21 |
+
|
| 22 |
+
### Model Description
|
| 23 |
+
|
| 24 |
+
- **Developed by:** [KARAKURI Inc.](https://about.karakuri.ai/)
|
| 25 |
+
- **Model type:** Causal decoder-only transformer language model
|
| 26 |
+
- **Languages**: Primarily English
|
| 27 |
+
- **License:** Apache 2.0
|
| 28 |
+
- **Finetuned from model:** [mistral-community/Mistral-7B-v0.2](https://huggingface.co/mistral-community/Mistral-7B-v0.2)
|
| 29 |
+
- **Contact**: For questions and comments about the model, please email `karakuri-rd@karakuri.ai`
|
| 30 |
+
|
| 31 |
+
## Usage
|
| 32 |
+
|
| 33 |
+
KARAKURI LM 7B APM v0.2 is a attribute prediction model that rates model responses on various aspects that makes a response desirable.
|
| 34 |
+
|
| 35 |
+
Given a conversation with multiple turns between user and assistant, the model rates the following attributes (between 0 and 4) for every assistant turn.
|
| 36 |
+
|
| 37 |
+
- helpfulness: Overall helpfulness of the response to the prompt.
|
| 38 |
+
- correctness: Inclusion of all pertinent facts without errors.
|
| 39 |
+
- coherence: Consistency and clarity of expression.
|
| 40 |
+
- complexity: Intellectual depth required to write response (i.e. whether the response can be written by anyone with basic language competency or requires deep domain expertise).
|
| 41 |
+
- verbosity: Amount of detail included in the response, relative to what is asked for in the prompt.
|
| 42 |
+
- quality: Perceived goodness of response.
|
| 43 |
+
- toxicity: Undesirable elements such as vulgar, harmful or potentially biased response.
|
| 44 |
+
- humor: Sense of humor within response.
|
| 45 |
+
- creativity: Willingness to generate non-conventional response.
|
| 46 |
+
|
| 47 |
+
The first five are derived from HelpSteer, while the remaining four are derived from OASST2.
|
| 48 |
+
|
| 49 |
+
You can run the model using the 🤗 Transformers:
|
| 50 |
+
|
| 51 |
+
```python
|
| 52 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 53 |
+
|
| 54 |
+
model_id = "karakuri-ai/karakuri-lm-7b-apm-v0.2"
|
| 55 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 56 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 57 |
+
model_id,
|
| 58 |
+
torch_dtype="auto",
|
| 59 |
+
device_map="auto",
|
| 60 |
+
)
|
| 61 |
+
|
| 62 |
+
messages = [
|
| 63 |
+
{"role": "user", "content": "Hello!"},
|
| 64 |
+
{"role": "assistant", "content": "Hello! How can I help you today?"},
|
| 65 |
+
]
|
| 66 |
+
tokenizer.apply_chat_template(
|
| 67 |
+
messages,
|
| 68 |
+
label="helpsteer",
|
| 69 |
+
tokenize=False,
|
| 70 |
+
add_generation_prompt=True,
|
| 71 |
+
)
|
| 72 |
+
# <bos>[INST] Hello! [/INST] Hello! How can I help you today? [ATTR_1]
|
| 73 |
+
|
| 74 |
+
input_ids = tokenizer.apply_chat_template(
|
| 75 |
+
messages,
|
| 76 |
+
label="helpsteer",
|
| 77 |
+
add_generation_prompt=True,
|
| 78 |
+
return_tensors="pt",
|
| 79 |
+
).to(model.device)
|
| 80 |
+
outputs = model.generate(input_ids, max_new_tokens=32)
|
| 81 |
+
tokenizer.decode(outputs[0][input_ids.shape[-1]:])
|
| 82 |
+
# helpfulness: 2 correctness: 1 coherence: 2 complexity: 1 verbosity: 1 [/ATTR_1]<eos>
|
| 83 |
+
|
| 84 |
+
messages += [
|
| 85 |
+
{"role": "label", "content": "helpfulness: 2 correctness: 1 coherence: 2 complexity: 1 verbosity: 1"},
|
| 86 |
+
{"role": "user", "content": "Thank you!"},
|
| 87 |
+
{"role": "assistant", "content": "You're welcome! I'm happy to help however I can."},
|
| 88 |
+
]
|
| 89 |
+
tokenizer.apply_chat_template(
|
| 90 |
+
messages,
|
| 91 |
+
label="helpsteer",
|
| 92 |
+
tokenize=False,
|
| 93 |
+
add_generation_prompt=True,
|
| 94 |
+
)
|
| 95 |
+
# <bos>[INST] Hello! [/INST] Hello! How can I help you today? [ATTR_1] helpfulness: 2 correctness: 1 coherence: 2 complexity: 1 verbosity: 1 [/ATTR_1]<eos>[INST] Thank you! [/INST] You're welcome! I'm happy to help however I can. [ATTR_1]
|
| 96 |
+
|
| 97 |
+
messages = [
|
| 98 |
+
{"role": "user", "content": "Hello!"},
|
| 99 |
+
{"role": "assistant", "content": "Hello! How can I help you today?"},
|
| 100 |
+
]
|
| 101 |
+
tokenizer.apply_chat_template(
|
| 102 |
+
messages,
|
| 103 |
+
label="oasst",
|
| 104 |
+
tokenize=False,
|
| 105 |
+
add_generation_prompt=True,
|
| 106 |
+
)
|
| 107 |
+
# <bos>[INST] Hello! [/INST] Hello! How can I help you today? [ATTR_2]
|
| 108 |
+
|
| 109 |
+
input_ids = tokenizer.apply_chat_template(
|
| 110 |
+
messages,
|
| 111 |
+
label="oasst",
|
| 112 |
+
add_generation_prompt=True,
|
| 113 |
+
return_tensors="pt",
|
| 114 |
+
).to(model.device)
|
| 115 |
+
outputs = model.generate(input_ids, max_new_tokens=32)
|
| 116 |
+
tokenizer.decode(outputs[0][input_ids.shape[-1]:])
|
| 117 |
+
# quality: 3 toxicity: 1 humor: 1 creativity: 1 [/ATTR_2]<eos>
|
| 118 |
+
```
|
| 119 |
+
|
| 120 |
+
## Training Details
|
| 121 |
+
|
| 122 |
+
### Training Data
|
| 123 |
+
|
| 124 |
+
- [OASST2](https://huggingface.co/datasets/OpenAssistant/oasst2)
|
| 125 |
+
- [HelpSteer](https://huggingface.co/datasets/nvidia/HelpSteer)
|
| 126 |
+
|
| 127 |
+
### Training Infrastructure
|
| 128 |
+
|
| 129 |
+
- **Hardware**: The model was trained on single node of an Amazon EC2 trn1.32xlarge instance.
|
| 130 |
+
- **Software**: We use code based on [neuronx-nemo-megatron](https://github.com/aws-neuron/neuronx-nemo-megatron).
|
| 131 |
+
|
| 132 |
+
## Model Citation
|
| 133 |
+
|
| 134 |
+
```
|
| 135 |
+
@misc{karakuri_lm_7b_apm_v02,
|
| 136 |
+
author = { {KARAKURI} {I}nc. },
|
| 137 |
+
title = { {KARAKURI} {LM} 7{B} {APM} v0.2 },
|
| 138 |
+
year = { 2024 },
|
| 139 |
+
url = { https://huggingface.co/karakuri-ai/karakuri-lm-7b-apm-v0.2 },
|
| 140 |
+
publisher = { Hugging Face },
|
| 141 |
+
journal = { Hugging Face repository }
|
| 142 |
+
}
|
| 143 |
+
```
|