Union Tool for inference on Sophgo chips
Project description
UnTool
UnTool是一个用于Sophon芯片推理的Python工具包,支持x86_64和aarch64架构,以及SOC和PCIE两种模式。
安装
pip install untool
使用示例
from untool import EngineLLM
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-m', '--model_path', type=str, required=True, help='path to the bmodel file')
parser.add_argument('-t', '--tokenizer_path', type=str, required=True, help='path to the tokenizer file')
parser.add_argument('-d', '--devid', type=int, default=0, help='device ID to use')
parser.add_argument('--generation_mode', type=str, choices=["greedy", "penalty_sample"], default="greedy", help='mode for generating next token')
parser.add_argument('--enable_history', action='store_true', help="if set, enables storing of history memory")
args = parser.parse_args()
engine = EngineLLM(args)
engine.chat()
from untool import EngineOV
net = EngineOV("rmbg.bmodel", device_id=0)
# Prepare input
image = preprocess_image(orig_image, model_input_size)
# Inference
result = net([image])[0]
# Post process
result_image = postprocess_image(result, orig_im_size)
其他
源代码仓库https://www.modelscope.cn/wlc952/UnTool.git
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
untool-0.0.6.tar.gz
(2.6 MB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file untool-0.0.6.tar.gz.
File metadata
- Download URL: untool-0.0.6.tar.gz
- Upload date:
- Size: 2.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6fee6fff7bbec7a71f3d8f1eae892d970a6290861ede535d4bf7bf8c2b99aa54
|
|
| MD5 |
a3c72b6ae79c3dc2dab2eb4ec5e01de2
|
|
| BLAKE2b-256 |
99e84dc46f49e1a5dac5e2560e1924607397cc1a4806df92441b7b1cc6ceebdb
|
File details
Details for the file untool-0.0.6-py3-none-any.whl.
File metadata
- Download URL: untool-0.0.6-py3-none-any.whl
- Upload date:
- Size: 2.6 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b23e4787fe4ad6759f3c2eabd776af8f5b4e0e4a5729d635339ab3f77e4f1d90
|
|
| MD5 |
caafc58655b8d3a41d7d38454fcc5e5c
|
|
| BLAKE2b-256 |
f846470b575bc184ff28f1dfb92dfafb1601dc25e8f35212cf64188436433f66
|