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.7.tar.gz (2.6 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.7-py3-none-any.whl (2.6 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: untool-0.0.7.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

Hashes for untool-0.0.7.tar.gz
Algorithm Hash digest
SHA256 fd759dd318a16c6d1fcced46ebd33cd7ad578c523512b0f398e3725394310c82
MD5 e6c6465e26cc9f126c27bcc71e778eea
BLAKE2b-256 72ac029d82ee2f6280ffd61105e4dbb2e7cff3fbac36bc0b5f98f23a827a4818

See more details on using hashes here.

File details

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

File metadata

  • Download URL: untool-0.0.7-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

Hashes for untool-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 84f0a1814820458a66946fd2cb7b3e12ffb47cf787ce2b31cfd5c8a484e862dc
MD5 65a50c63fec50d3e1593f41400085074
BLAKE2b-256 722237eced9794b0605ad5216ccedf5951e44ddf852762829d5a1e083ecbcc60

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