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
KARAKURI LM 7B APM v0.2- GGUF
This is quantized version of karakuri-ai/karakuri-lm-7b-apm-v0.2 created using llama.cpp
Model Details
Model Description
- Developed by: KARAKURI Inc.
- Model type: Causal decoder-only transformer language model
- Languages: Primarily English
- License: Apache 2.0
- Finetuned from model: mistral-community/Mistral-7B-v0.2
- Contact: For questions and comments about the model, please email
karakuri-rd@karakuri.ai
Usage
KARAKURI LM 7B APM v0.2 is a attribute prediction model that rates model responses on various aspects that makes a response desirable.
Given a conversation with multiple turns between user and assistant, the model rates the following attributes (between 0 and 4) for every assistant turn.
- helpfulness: Overall helpfulness of the response to the prompt.
- correctness: Inclusion of all pertinent facts without errors.
- coherence: Consistency and clarity of expression.
- 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).
- verbosity: Amount of detail included in the response, relative to what is asked for in the prompt.
- quality: Perceived goodness of response.
- toxicity: Undesirable elements such as vulgar, harmful or potentially biased response.
- humor: Sense of humor within response.
- creativity: Willingness to generate non-conventional response.
The first five are derived from HelpSteer, while the remaining four are derived from OASST2.
You can run the model using the 🤗 Transformers:
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "karakuri-ai/karakuri-lm-7b-apm-v0.2"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype="auto",
device_map="auto",
)
messages = [
{"role": "user", "content": "Hello!"},
{"role": "assistant", "content": "Hello! How can I help you today?"},
]
tokenizer.apply_chat_template(
messages,
label="helpsteer",
tokenize=False,
add_generation_prompt=True,
)
# <bos>[INST] Hello! [/INST] Hello! How can I help you today? [ATTR_1]
input_ids = tokenizer.apply_chat_template(
messages,
label="helpsteer",
add_generation_prompt=True,
return_tensors="pt",
).to(model.device)
outputs = model.generate(input_ids, max_new_tokens=32)
tokenizer.decode(outputs[0][input_ids.shape[-1]:])
# helpfulness: 2 correctness: 1 coherence: 2 complexity: 1 verbosity: 1 [/ATTR_1]<eos>
messages += [
{"role": "label", "content": "helpfulness: 2 correctness: 1 coherence: 2 complexity: 1 verbosity: 1"},
{"role": "user", "content": "Thank you!"},
{"role": "assistant", "content": "You're welcome! I'm happy to help however I can."},
]
tokenizer.apply_chat_template(
messages,
label="helpsteer",
tokenize=False,
add_generation_prompt=True,
)
# <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]
messages = [
{"role": "user", "content": "Hello!"},
{"role": "assistant", "content": "Hello! How can I help you today?"},
]
tokenizer.apply_chat_template(
messages,
label="oasst",
tokenize=False,
add_generation_prompt=True,
)
# <bos>[INST] Hello! [/INST] Hello! How can I help you today? [ATTR_2]
input_ids = tokenizer.apply_chat_template(
messages,
label="oasst",
add_generation_prompt=True,
return_tensors="pt",
).to(model.device)
outputs = model.generate(input_ids, max_new_tokens=32)
tokenizer.decode(outputs[0][input_ids.shape[-1]:])
# quality: 3 toxicity: 1 humor: 1 creativity: 1 [/ATTR_2]<eos>
Training Details
Training Data
Training Infrastructure
- Hardware: The model was trained on single node of an Amazon EC2 trn1.32xlarge instance.
- Software: We use code based on neuronx-nemo-megatron.
Model Citation
@misc{karakuri_lm_7b_apm_v02,
author = { {KARAKURI} {I}nc. },
title = { {KARAKURI} {LM} 7{B} {APM} v0.2 },
year = { 2024 },
url = { https://huggingface.co/karakuri-ai/karakuri-lm-7b-apm-v0.2 },
publisher = { Hugging Face },
journal = { Hugging Face repository }
}
- Downloads last month
- 234
2-bit
3-bit
4-bit
5-bit
6-bit
8-bit
Model tree for QuantFactory/karakuri-lm-7b-apm-v0.2-GGUF
Base model
mistral-community/Mistral-7B-v0.2