Instructions to use jinkyeongk/Midm-2.0-Base-Instruct-AWQ with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use jinkyeongk/Midm-2.0-Base-Instruct-AWQ with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="jinkyeongk/Midm-2.0-Base-Instruct-AWQ") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("jinkyeongk/Midm-2.0-Base-Instruct-AWQ") model = AutoModelForCausalLM.from_pretrained("jinkyeongk/Midm-2.0-Base-Instruct-AWQ") 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]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use jinkyeongk/Midm-2.0-Base-Instruct-AWQ with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "jinkyeongk/Midm-2.0-Base-Instruct-AWQ" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "jinkyeongk/Midm-2.0-Base-Instruct-AWQ", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/jinkyeongk/Midm-2.0-Base-Instruct-AWQ
- SGLang
How to use jinkyeongk/Midm-2.0-Base-Instruct-AWQ 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 "jinkyeongk/Midm-2.0-Base-Instruct-AWQ" \ --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": "jinkyeongk/Midm-2.0-Base-Instruct-AWQ", "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 "jinkyeongk/Midm-2.0-Base-Instruct-AWQ" \ --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": "jinkyeongk/Midm-2.0-Base-Instruct-AWQ", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use jinkyeongk/Midm-2.0-Base-Instruct-AWQ with Docker Model Runner:
docker model run hf.co/jinkyeongk/Midm-2.0-Base-Instruct-AWQ
Midm-2.0-Base-Instruct - AWQ 4-bit Quantized Version
This repository contains the AWQ (Activation-aware Weight Quantization) 4-bit quantized version of the K-intelligence/Midm-2.0-Base-Instruct model by KT AI.
This model is the result of a journey to solve real-world performance and cost issues encountered in a production environment. I hope this experience can be a practical guide for other developers facing similar challenges.
Model Details
- Base Model:
K-intelligence/Midm-2.0-Base-Instruct - Quantization Method: AWQ (Activation-aware Weight Quantization)
- Quantization Config:
w_bit: 4q_group_size: 128zero_point: True
- Library:
AutoAWQ
⚙️ How to Get Started
To use this model, you will need to install the transformers, accelerate, and autoawq libraries.
pip install transformers accelerate autoawq
Usage Example
Python
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
model_id = "jinkyeongk/Midm-2.0-Base-Instruct-AWQ"
# Load the tokenizer and model
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
device_map="auto",
torch_dtype=torch.float16
).eval()
# Construct the chat prompt
messages = [
{"role": "user", "content": "Who are you?"}
]
input_ids = tokenizer.apply_chat_template(messages, return_tensors="pt").to(model.device)
# Generate a response
outputs = model.generate(input_ids, max_new_tokens=512, do_sample=True, temperature=0.7)
response = tokenizer.decode(outputs[0][input_ids.shape[1]:], skip_special_tokens=True)
print(response)
📊 Quantization Evaluation
To measure the performance degradation from quantization, the original (FP16) and quantized (AWQ) models were evaluated against two major Korean benchmarks.
Ko-Best: Measures objective knowledge and reasoning skills (Accuracy).
Ko-MTBench: Measures subjective conversational ability (Scores graded by GPT-4o as a judge).
Final Evaluation Results
| Model | Benchmark | Metric | Score / Accuracy |
|---|---|---|---|
K-intelligence/Midm-2.0-Base-Instruct (FP16) |
skt/kobest_v1 | hellaswag (Accuracy) | 0.4900 |
jinkyeongk/Midm-2.0-Base-Instruct-AWQ (AWQ) |
skt/kobest_v1 | hellaswag (Accuracy) | 0.4800 |
K-intelligence/Midm-2.0-Base-Instruct (FP16) |
LGAI-EXAONE/KoMT-Bench | Avg. Score (by GPT-4o) | 8.50 / 10.0 |
jinkyeongk/Midm-2.0-Base-Instruct-AWQ (AWQ) |
LGAI-EXAONE/KoMT-Bench | Avg. Score (by GPT-4o) | 6.40 / 10.0 |
Analysis
The results from the Ko-Best (hellaswag) benchmark show that the performance drop in objective reasoning ability due to AWQ 4-bit quantization was a mere 1.0 percentage point, which is a negligible decrease.
However, in the Ko-MTBench subjective evaluation using GPT-4o as a judge, a more significant performance drop of 2.1 points on average was observed.
This suggests that while AWQ quantization maintains performance on well-defined, knowledge-based tasks like multiple-choice questions (Ko-Best), it can lead to some loss in nuance, expressiveness, or the sophistication of reasoning in more open-ended, conversational tasks (Ko-MTBench).
Therefore, this quantized model offers a massive improvement in speed and cost-efficiency at the expense of a slight trade-off in creative or complex conversational abilities. Users should consider this trade-off based on their specific application.
- Downloads last month
- 29
Model tree for jinkyeongk/Midm-2.0-Base-Instruct-AWQ
Base model
K-intelligence/Midm-2.0-Base-Instruct