Skip to main content

Dwave SONA Core

迪威智能 SONA 服務專用核心開發套件

安裝與使用

開發環境需求

  • Python 3.8 或更新版本
  • poetry
  • ffmpeg

安裝與使用

  1. 環境建構
$ pip install poetry
  1. 下載與安裝
$ export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring
$ poetry add git+ssh://git@github.com/DeepWaveInc/dwave-sona-core.git
  1. 撰寫 Inferencer 模組
from typing import Dict, List

from loguru import logger
from pydantic import BaseModel, Field
from sona.core.inferencer import InferencerBase
from sona.core.messages import File, Result


class InputParamSchema(BaseModel):
    param1: int = Field(42, description="this is the value of param1")
    param2: str = Field("43", description="this is the value of param2")


class InputFilesSchema(BaseModel):
    origin: str = Field("data/test.mp3", description="this is the value of origin")


class SimpleInferencer(InferencerBase):
    name = "mock"
    description = "This is a simple inferencer"
    input_params_schema = InputParamSchema()
    input_files_schema = InputFilesSchema()

    def on_load(self) -> None:
        logger.info(f"Download {self.__class__.__name__} models...")

    def inference(self, params: Dict, files: List[File]) -> Result:
        logger.info(f"Get params {params}")
        logger.info(f"Get files {files}")
        return Result(
            files=[File(label="output", path=files[0].path)],
            data={"output_key": "output_val"},
        )


if __name__ == "__main__":
    inferencer = SimpleInferencer()
    inferencer.cmd()
  1. 測試指令
$ python simple.py --help
Usage: simple.py [OPTIONS] <filepath:origin>

  This is a simple inferencer

Options:
  --param2 <string>   this is the value of param2
  --param1 <integer>  this is the value of param1
  --help              Show this message and exit.
$ python tests/simple.py tests/simple.py
2023-10-17 02:18:41.702 | INFO     | __main__:on_load:25 - Download SimpleInferencer models...
2023-10-17 02:18:41.702 | INFO     | __main__:inference:28 - Get params {'param2': '43', 'param1': 42}
2023-10-17 02:18:41.703 | INFO     | __main__:inference:29 - Get files [File(label='origin', path='tests/simple.py', metadata={})]
{"files":[{"label":"output","path":"tests/simple.py","metadata":{}}],"data":{"output_key":"output_val"}}

Metadata

Release files for dwave-sona-core 1.6.25

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dwave-sona-core 1.6.25
File Size Uploaded Provenance Actions
dwave_sona_core-1.6.25.tar.gz 31.9 kB Without provenance Details for dwave_sona_core-1.6.25.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dwave-sona-core 1.6.25
File Interpreter ABI Platform Actions
dwave_sona_core-1.6.25-py3-none-any.whl Python 3 none any Details for dwave_sona_core-1.6.25-py3-none-any.whl

Total release size: 89.4 kB

Release files / dwave_sona_core-1.6.25.tar.gz

Download URL dwave_sona_core-1.6.25.tar.gz
Size 31.9 kB
Tags Source
SHA-256 checksum
How to use checksums
53963bb057dbc9769d0d3820a70d2ad623f7cd14b099d9c3dee026a5cb3adb42
BLAKE2b-256 checksum
How to use checksums
dbabadd36eb7abfc9c3367d98c52c4097a46ba248a8333d857516779b348ab0e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / dwave_sona_core-1.6.25-py3-none-any.whl

Download URL dwave_sona_core-1.6.25-py3-none-any.whl
Size 57.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cb84bac8bcc9a4dde8c0abbe8cf1b8d8382319e7487f54062628027867fa8a39
BLAKE2b-256 checksum
How to use checksums
6897b6c66bde7e84a99dac7e36538b13c965915dcaeecd9c6bff117ad93ecbf4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for dwave-sona-core 1.6.25

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.6.25 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page