Downloads · 30 days
0
marcusmi4n/abeja-qwen2.5-7b-japanese-quantized-qnn
abeja-qwen2.5-7b-japanese-quantized-qnn is a machine learning model from marcusmi4n. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
This repository contains the quantized and optimized version of the ABEJA Qwen2.5 7B Japanese model, specifically compiled for Qualcomm Neural Network (QNN) hardware acceleration.
Downloads · 30 days
0
Access
Public
Updated Sep 1, 2025
Repo size
—
Likes
0
Public
Click a slice to open those files.
.md9.2 KB · 86%
From the Hugging Face model README
This repository contains the quantized and optimized version of the ABEJA Qwen2.5 7B Japanese model, specifically compiled for Qualcomm Neural Network (QNN) hardware acceleration.
YES, this model fully supports the Snapdragon X Elite X1E-80-100!
The ABEJA Qwen 2.5 7B Japanese model has been specifically optimized for the Snapdragon X Elite's powerful NPU:
├── README.md # This file
├── config.json # Model configuration
├── tokenizer.json # Tokenizer configuration
├── tokenizer_config.json # Tokenizer settings
├── model.safetensors # Quantized model weights
├── model_info.json # Model information
├── onnx/ # ONNX exported models
│ ├── prefill/model.onnx # Prefill model
│ └── token_gen/model.onnx # Token generation model
├── quantized_onnx/ # Quantized ONNX models
│ ├── prefill/model_quantized.onnx
│ └── token_gen/model_quantized.onnx
├── qnn_compiled/ # QNN compiled models
│ ├── prefill/ # QNN prefill model
│ └── token_gen/ # QNN token generation model
└── ... # Other model artifacts
# Install required packages
pip install transformers
pip install bitsandbytes
pip install torch
pip install accelerate
pip install onnxruntime
pip install onnxruntime-qnn # For QNN deployment
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
import torch
# Configure 4-bit quantization
quantization_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_compute_dtype=torch.float16,
bnb_4bit_use_double_quant=True,
)
# Load tokenizer
tokenizer = AutoTokenizer.from_pretrained("your-username/abeja-qwen2.5-7b-japanese-quantized-qnn")
# Load quantized model
model = AutoModelForCausalLM.from_pretrained(
"your-username/abeja-qwen2.5-7b-japanese-quantized-qnn",
quantization_config=quantization_config,
device_map="auto",
trust_remote_code=True
)
# Example inference
text = "こんにちは、今日は良い天気ですね。"
inputs = tokenizer(text, return_tensors="pt")
with torch.no_grad():
outputs = model.generate(**inputs, max_length=100, temperature=0.7)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)
import onnxruntime as ort
import numpy as np
# Load ONNX model
session = ort.InferenceSession("onnx/prefill/model.onnx")
# Example inference
text = "人工知能について説明してください。"
inputs = tokenizer(text, return_tensors="pt")
outputs = session.run(None, {
"input_ids": inputs["input_ids"].numpy(),
"attention_mask": inputs["attention_mask"].numpy()
})
import onnxruntime as ort
# Configure QNN provider for Snapdragon X Elite
providers = [
("QNNExecutionProvider", {
"backend_path": "/opt/qcom/aistack/qnn/2.18.0.240127/lib/aarch64-linux-gcc9.0/libQnnHtp.so",
"profiling_level": "basic",
"rpc_control_latency": 10,
"htp_performance_mode": "burst", # Optimize for Snapdragon X Elite
"htp_graph_finalization_optimization_mode": "1"
})
]
# Create inference session with QNN
session = ort.InferenceSession("qnn_compiled/prefill/model.serialized", providers=providers)
# Run inference on Snapdragon X Elite NPU
outputs = session.run(None, input_dict)
# Optimize for Snapdragon X Elite NPU
qnn_provider_options = {
"backend_path": "/opt/qcom/aistack/qnn/2.18.0.240127/lib/aarch64-linux-gcc9.0/libQnnHtp.so",
"profiling_level": "basic",
"rpc_control_latency": 10,
"htp_performance_mode": "burst", # Maximum performance
"htp_graph_finalization_optimization_mode": "1", # Optimize for X Elite
"htp_precision": "fp16", # Use FP16 for better performance
"htp_use_conv_hmx": "1", # Use Hexagon Matrix Extensions
"htp_use_dlbc": "1" # Use Deep Learning Block Cache
}
providers = [("QNNExecutionProvider", qnn_provider_options)]
session = ort.InferenceSession("qnn_compiled/prefill/model.serialized", providers=providers)
| Hardware | Tokens/sec | Memory Usage | NPU Utilization |
|---|---|---|---|
| Snapdragon X Elite | 15-25 | 3-4GB | 85-95% |
| Snapdragon 8cx Gen 2+ | 8-15 | 4-6GB | 70-85% |
| Snapdragon 8 Gen 1+ | 10-18 | 3-5GB | 75-90% |
| Legacy Snapdragon | 5-12 | 5-8GB | 60-80% |
This model inherits the license from the original ABEJA Qwen2.5 model.
If you use this model, please cite the original ABEJA Qwen2.5 model:
@misc{abeja-qwen2.5-7b-japanese,
title={ABEJA-Qwen2.5-7b-Japanese-v0.1},
author={ABEJA},
year={2024},
url={https://huggingface.co/abeja/ABEJA-Qwen2.5-7b-Japanese-v0.1}
}