Skip to main content

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


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.5.tar.gz (1.8 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

untool-0.0.5-py3-none-any.whl (1.8 MB view details)

Uploaded Python 3

File details

Details for the file untool-0.0.5.tar.gz.

File metadata

  • Download URL: untool-0.0.5.tar.gz
  • Upload date:
  • Size: 1.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for untool-0.0.5.tar.gz
Algorithm Hash digest
SHA256 c28ff058e5ed34afba67dd6f99b9ba21ef1fc4cd11e8a12ce979db92fe247718
MD5 6d8e402cf71a5525c2fea09f7355aef9
BLAKE2b-256 2bfbe7c25414cd60838c7b27e39790bbd4b03ae181bafb0ab1ad4d5fc99020a4

See more details on using hashes here.

File details

Details for the file untool-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: untool-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 1.8 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for untool-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 1ff02283bf48478befbdcbe46af2153befe764c3b772ec7c1254fc5aca14dba2
MD5 25c68c51b61e01dbf005a90e939d899a
BLAKE2b-256 65871cca11ab8f535be0416ed88e9eb1d22fb184b32a6ac161b29a39d6c21952

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page