Text Generation
Transformers
Safetensors
MLX
English
Japanese
mixtral
steerlm
conversational
Eval Results (legacy)
text-generation-inference
Instructions to use mlx-community/karakuri-lm-8x7b-chat-v0.1-8bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mlx-community/karakuri-lm-8x7b-chat-v0.1-8bit with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="mlx-community/karakuri-lm-8x7b-chat-v0.1-8bit") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("mlx-community/karakuri-lm-8x7b-chat-v0.1-8bit") model = AutoModelForCausalLM.from_pretrained("mlx-community/karakuri-lm-8x7b-chat-v0.1-8bit") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - MLX
How to use mlx-community/karakuri-lm-8x7b-chat-v0.1-8bit with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("mlx-community/karakuri-lm-8x7b-chat-v0.1-8bit") prompt = "Write a story about Einstein" messages = [{"role": "user", "content": prompt}] prompt = tokenizer.apply_chat_template( messages, add_generation_prompt=True ) text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- vLLM
How to use mlx-community/karakuri-lm-8x7b-chat-v0.1-8bit with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "mlx-community/karakuri-lm-8x7b-chat-v0.1-8bit" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mlx-community/karakuri-lm-8x7b-chat-v0.1-8bit", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/mlx-community/karakuri-lm-8x7b-chat-v0.1-8bit
- SGLang
How to use mlx-community/karakuri-lm-8x7b-chat-v0.1-8bit 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 "mlx-community/karakuri-lm-8x7b-chat-v0.1-8bit" \ --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": "mlx-community/karakuri-lm-8x7b-chat-v0.1-8bit", "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 "mlx-community/karakuri-lm-8x7b-chat-v0.1-8bit" \ --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": "mlx-community/karakuri-lm-8x7b-chat-v0.1-8bit", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - MLX LM
How to use mlx-community/karakuri-lm-8x7b-chat-v0.1-8bit with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "mlx-community/karakuri-lm-8x7b-chat-v0.1-8bit"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "mlx-community/karakuri-lm-8x7b-chat-v0.1-8bit" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mlx-community/karakuri-lm-8x7b-chat-v0.1-8bit", "messages": [ {"role": "user", "content": "Hello"} ] }' - Docker Model Runner
How to use mlx-community/karakuri-lm-8x7b-chat-v0.1-8bit with Docker Model Runner:
docker model run hf.co/mlx-community/karakuri-lm-8x7b-chat-v0.1-8bit
10bf2ece3fc58a3cbba789fd2962d0f98d86f4d872dea20841b67e49443f932d
Browse files- README.md +18 -8
- config.json +4 -0
- model.safetensors.index.json +0 -0
- tokenizer.json +0 -0
- tokenizer_config.json +1 -0
README.md
CHANGED
|
@@ -1,17 +1,17 @@
|
|
| 1 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
language:
|
| 3 |
- en
|
| 4 |
- ja
|
| 5 |
-
license: apache-2.0
|
| 6 |
library_name: transformers
|
|
|
|
| 7 |
tags:
|
| 8 |
- mixtral
|
| 9 |
- steerlm
|
| 10 |
- mlx
|
| 11 |
-
base_model: tokyotech-llm/Swallow-MX-8x7b-NVE-v0.1
|
| 12 |
-
datasets:
|
| 13 |
-
- OpenAssistant/oasst2
|
| 14 |
-
- nvidia/HelpSteer
|
| 15 |
model-index:
|
| 16 |
- name: karakuri-ai/karakuri-lm-8x7b-chat-v0.1
|
| 17 |
results:
|
|
@@ -33,8 +33,9 @@ model-index:
|
|
| 33 |
---
|
| 34 |
|
| 35 |
# mlx-community/karakuri-lm-8x7b-chat-v0.1-8bit
|
| 36 |
-
|
| 37 |
-
|
|
|
|
| 38 |
## Use with mlx
|
| 39 |
|
| 40 |
```bash
|
|
@@ -45,5 +46,14 @@ pip install mlx-lm
|
|
| 45 |
from mlx_lm import load, generate
|
| 46 |
|
| 47 |
model, tokenizer = load("mlx-community/karakuri-lm-8x7b-chat-v0.1-8bit")
|
| 48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
```
|
|
|
|
| 1 |
---
|
| 2 |
+
base_model: karakuri-ai/karakuri-lm-8x7b-chat-v0.1
|
| 3 |
+
datasets:
|
| 4 |
+
- OpenAssistant/oasst2
|
| 5 |
+
- nvidia/HelpSteer
|
| 6 |
language:
|
| 7 |
- en
|
| 8 |
- ja
|
|
|
|
| 9 |
library_name: transformers
|
| 10 |
+
license: apache-2.0
|
| 11 |
tags:
|
| 12 |
- mixtral
|
| 13 |
- steerlm
|
| 14 |
- mlx
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
model-index:
|
| 16 |
- name: karakuri-ai/karakuri-lm-8x7b-chat-v0.1
|
| 17 |
results:
|
|
|
|
| 33 |
---
|
| 34 |
|
| 35 |
# mlx-community/karakuri-lm-8x7b-chat-v0.1-8bit
|
| 36 |
+
|
| 37 |
+
The Model [mlx-community/karakuri-lm-8x7b-chat-v0.1-8bit](https://huggingface.co/mlx-community/karakuri-lm-8x7b-chat-v0.1-8bit) was converted to MLX format from [karakuri-ai/karakuri-lm-8x7b-chat-v0.1](https://huggingface.co/karakuri-ai/karakuri-lm-8x7b-chat-v0.1) using mlx-lm version **0.19.0**.
|
| 38 |
+
|
| 39 |
## Use with mlx
|
| 40 |
|
| 41 |
```bash
|
|
|
|
| 46 |
from mlx_lm import load, generate
|
| 47 |
|
| 48 |
model, tokenizer = load("mlx-community/karakuri-lm-8x7b-chat-v0.1-8bit")
|
| 49 |
+
|
| 50 |
+
prompt="hello"
|
| 51 |
+
|
| 52 |
+
if hasattr(tokenizer, "apply_chat_template") and tokenizer.chat_template is not None:
|
| 53 |
+
messages = [{"role": "user", "content": prompt}]
|
| 54 |
+
prompt = tokenizer.apply_chat_template(
|
| 55 |
+
messages, tokenize=False, add_generation_prompt=True
|
| 56 |
+
)
|
| 57 |
+
|
| 58 |
+
response = generate(model, tokenizer, prompt=prompt, verbose=True)
|
| 59 |
```
|
config.json
CHANGED
|
@@ -21,6 +21,10 @@
|
|
| 21 |
"group_size": 64,
|
| 22 |
"bits": 8
|
| 23 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
"rms_norm_eps": 1e-05,
|
| 25 |
"rope_theta": 1000000.0,
|
| 26 |
"router_aux_loss_coef": 0.02,
|
|
|
|
| 21 |
"group_size": 64,
|
| 22 |
"bits": 8
|
| 23 |
},
|
| 24 |
+
"quantization_config": {
|
| 25 |
+
"group_size": 64,
|
| 26 |
+
"bits": 8
|
| 27 |
+
},
|
| 28 |
"rms_norm_eps": 1e-05,
|
| 29 |
"rope_theta": 1000000.0,
|
| 30 |
"router_aux_loss_coef": 0.02,
|
model.safetensors.index.json
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer.json
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
{
|
| 2 |
"add_bos_token": true,
|
| 3 |
"add_eos_token": false,
|
|
|
|
| 4 |
"added_tokens_decoder": {
|
| 5 |
"0": {
|
| 6 |
"content": "<unk>",
|
|
|
|
| 1 |
{
|
| 2 |
"add_bos_token": true,
|
| 3 |
"add_eos_token": false,
|
| 4 |
+
"add_prefix_space": null,
|
| 5 |
"added_tokens_decoder": {
|
| 6 |
"0": {
|
| 7 |
"content": "<unk>",
|