Skip to main content

Common libraries for converting machine learning models to TVM Relay IR

Project description

Neo Framework -> Relay IR converters

This is a set of utility classes for converting ML models to TVM Relay IR.

Installation

pip install NeoCompilerModelLoaders

This package does not assume any framework dependencies. It is the responsibility of the consumer to have installed the framework versions that they choose to support.

Usage

import tarfile

from neo_loader import load_model

model_artifacts = []
with tarfile.open('/path/to/model.tar.gz', 'r:gz') as tf:
    tf.extractall()
    model_artifacts = tf.getnames()

relay_artifacts = load_model(
    model_artifacts=model_artifacts,
    input_shape={'data': [1, 3, 224, 224]},
    framework='tensorflow'
)

def relay_func(relay_artifacts: Dict) -> object:
    return relay_artifacts['model_objects'][0]

def relay_params(relay_artifacts: Dict) -> object:
    return relay_artifacts['model_objects'][1]

def relay_dtype(relay_artifacts: Dict) -> object:
    if len(relay_artifacts['model_objects']) == 2:
        return {}
    else:
        return relay_artifacts['model_objects'][2]

Security

See CONTRIBUTING for more information.

License

This project is licensed under the Apache-2.0 License.

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

NeoCompilerModelLoaders-1.0.1.tar.gz (24.8 kB view details)

Uploaded Source

File details

Details for the file NeoCompilerModelLoaders-1.0.1.tar.gz.

File metadata

  • Download URL: NeoCompilerModelLoaders-1.0.1.tar.gz
  • Upload date:
  • Size: 24.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

File hashes

Hashes for NeoCompilerModelLoaders-1.0.1.tar.gz
Algorithm Hash digest
SHA256 d39b633b6e05a73e90cd64013ce29d960eaca06ff12c76da5fd86f4dd5b9f4bc
MD5 a9cc2ed7d9dc125f492a7f37e400833d
BLAKE2b-256 35d1f7286bf9c6ba603947cf4938701b29992165315b4c2858953a4cc4e46b2f

See more details on using hashes here.

Supported by

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