How to use the hydrosdk.sdk.Monitoring function in hydrosdk

To help you get started, we’ve selected a few hydrosdk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Hydrospheredata / kubeflow-workshop / 03_release-model / release.py View on Github external
metadata["loss"] = args.loss
    if args.steps:
        metadata["steps"] = args.steps

    signature = sdk.Signature('predict')\
        .with_input('imgs', 'float32', [-1, 28, 28, 1], 'image')\
        .with_output('probabilities', 'float32', [-1, args.classes])\
        .with_output('class_ids', 'int64', [-1, 1])\
        .with_output('logits', 'float32', [-1, args.classes])\
        .with_output('classes', 'string', [-1, 1])

    monitoring = [
        sdk.Monitoring('Requests').with_spec('CounterMetricSpec', interval=15),
        sdk.Monitoring('Latency').with_spec('LatencyMetricSpec', interval=15),
        sdk.Monitoring('Accuracy').with_spec('AccuracyMetricSpec'),
        sdk.Monitoring('Autoencoder') \
            .with_health(True) \
            .with_spec(
                kind='ImageAEMetricSpec', 
                threshold=0.15, 
                application=args.autoencoder_app
            )
    ]

    model = sdk.Model() \
        .with_name(args.model_name) \
        .with_runtime('hydrosphere/serving-runtime-tensorflow-1.13.1:latest') \
        .with_metadata(metadata) \
        .with_payload(payload) \
        .with_signature(signature) \
        .with_monitoring(monitoring)
github Hydrospheredata / kubeflow-workshop / steps / release-model / release_model.py View on Github external
def main(drift_detector_app, model_name, runtime, payload, metadata, hydrosphere_uri, *args, **kwargs):
    monitoring = [
        sdk.Monitoring('Drift Detector').with_health(True) \
            .with_spec(
                kind='CustomModelMetricSpec', 
                threshold=0.15, 
                operator="<=",
                application=drift_detector_app
            )
    ]

    logger.info("Creating a Model object")
    model = sdk.Model()
    logger.info(f"Adding payload\n{payload}")
    model = model.with_payload(payload)
    logger.info(f"Adding runtime\n{runtime}", )
    model = model.with_runtime(runtime)
    logger.info(f"Adding metadata\n{metadata}")
    model = model.with_metadata(metadata)
github Hydrospheredata / kubeflow-workshop / 03_release-model / release.py View on Github external
if args.accuracy:
        metadata["accuracy"] = args.accuracy
    if args.loss:
        metadata["loss"] = args.loss
    if args.steps:
        metadata["steps"] = args.steps

    signature = sdk.Signature('predict')\
        .with_input('imgs', 'float32', [-1, 28, 28, 1], 'image')\
        .with_output('probabilities', 'float32', [-1, args.classes])\
        .with_output('class_ids', 'int64', [-1, 1])\
        .with_output('logits', 'float32', [-1, args.classes])\
        .with_output('classes', 'string', [-1, 1])

    monitoring = [
        sdk.Monitoring('Requests').with_spec('CounterMetricSpec', interval=15),
        sdk.Monitoring('Latency').with_spec('LatencyMetricSpec', interval=15),
        sdk.Monitoring('Accuracy').with_spec('AccuracyMetricSpec'),
        sdk.Monitoring('Autoencoder') \
            .with_health(True) \
            .with_spec(
                kind='ImageAEMetricSpec', 
                threshold=0.15, 
                application=args.autoencoder_app
            )
    ]

    model = sdk.Model() \
        .with_name(args.model_name) \
        .with_runtime('hydrosphere/serving-runtime-tensorflow-1.13.1:latest') \
        .with_metadata(metadata) \
        .with_payload(payload) \
github Hydrospheredata / kubeflow-workshop / 03_release-model / release.py View on Github external
metadata["accuracy"] = args.accuracy
    if args.loss:
        metadata["loss"] = args.loss
    if args.steps:
        metadata["steps"] = args.steps

    signature = sdk.Signature('predict')\
        .with_input('imgs', 'float32', [-1, 28, 28, 1], 'image')\
        .with_output('probabilities', 'float32', [-1, args.classes])\
        .with_output('class_ids', 'int64', [-1, 1])\
        .with_output('logits', 'float32', [-1, args.classes])\
        .with_output('classes', 'string', [-1, 1])

    monitoring = [
        sdk.Monitoring('Requests').with_spec('CounterMetricSpec', interval=15),
        sdk.Monitoring('Latency').with_spec('LatencyMetricSpec', interval=15),
        sdk.Monitoring('Accuracy').with_spec('AccuracyMetricSpec'),
        sdk.Monitoring('Autoencoder') \
            .with_health(True) \
            .with_spec(
                kind='ImageAEMetricSpec', 
                threshold=0.15, 
                application=args.autoencoder_app
            )
    ]

    model = sdk.Model() \
        .with_name(args.model_name) \
        .with_runtime('hydrosphere/serving-runtime-tensorflow-1.13.1:latest') \
        .with_metadata(metadata) \
        .with_payload(payload) \
        .with_signature(signature) \
github Hydrospheredata / kubeflow-workshop / 03_release / execute.py View on Github external
'batch_size': arguments['batch_size'],
        'accuracy': str(arguments['accuracy']),
        'data': arguments['data_path']
    }

    signature = sdk.Signature('predict')\
        .with_input('imgs', 'float32', [-1, 28, 28, 1], 'image')\
        .with_output('probabilities', 'float32', [-1, 10])\
        .with_output('class_ids', 'int64', [-1, 1])\
        .with_output('logits', 'float32', [-1, 10])\
        .with_output('classes', 'string', [-1, 1])

    monitoring = [
        sdk.Monitoring('Requests').with_spec('CounterMetricSpec', interval = 15),
        sdk.Monitoring('Latency').with_spec('LatencyMetricSpec', interval = 15),
        sdk.Monitoring('Accuracy').with_spec('AccuracyMetricSpec'),
        sdk.Monitoring('Autoencoder').with_health(True).with_spec('ImageAEMetricSpec', threshold=0.15, application='mnist-concept-app')
    ]

    model = sdk.Model()\
        .with_name(arguments['model_name'])\
        .with_runtime('hydrosphere/serving-runtime-tensorflow-1.13.1:latest')\
        .with_metadata(metadata)\
        .with_payload(payload)\
        .with_signature(signature)

    result = model.apply(arguments['hydrosphere_address'])
    print(result)

# i.  Upload the model to Hydrosphere Serving
# ii. Parse the status of the model uploading, retrieve the built 
#     model version and write it to the `/model_version.txt` file. 
github Hydrospheredata / kubeflow-workshop / 03_release-model / release.py View on Github external
if args.loss:
        metadata["loss"] = args.loss
    if args.steps:
        metadata["steps"] = args.steps

    signature = sdk.Signature('predict')\
        .with_input('imgs', 'float32', [-1, 28, 28, 1], 'image')\
        .with_output('probabilities', 'float32', [-1, args.classes])\
        .with_output('class_ids', 'int64', [-1, 1])\
        .with_output('logits', 'float32', [-1, args.classes])\
        .with_output('classes', 'string', [-1, 1])

    monitoring = [
        sdk.Monitoring('Requests').with_spec('CounterMetricSpec', interval=15),
        sdk.Monitoring('Latency').with_spec('LatencyMetricSpec', interval=15),
        sdk.Monitoring('Accuracy').with_spec('AccuracyMetricSpec'),
        sdk.Monitoring('Autoencoder') \
            .with_health(True) \
            .with_spec(
                kind='ImageAEMetricSpec', 
                threshold=0.15, 
                application=args.autoencoder_app
            )
    ]

    model = sdk.Model() \
        .with_name(args.model_name) \
        .with_runtime('hydrosphere/serving-runtime-tensorflow-1.13.1:latest') \
        .with_metadata(metadata) \
        .with_payload(payload) \
        .with_signature(signature) \
        .with_monitoring(monitoring)
github Hydrospheredata / kubeflow-workshop / 03_release / execute.py View on Github external
'learning_rate': arguments['learning_rate'],
        'epochs': arguments['epochs'],
        'batch_size': arguments['batch_size'],
        'accuracy': str(arguments['accuracy']),
        'data': arguments['data_path']
    }

    signature = sdk.Signature('predict')\
        .with_input('imgs', 'float32', [-1, 28, 28, 1], 'image')\
        .with_output('probabilities', 'float32', [-1, 10])\
        .with_output('class_ids', 'int64', [-1, 1])\
        .with_output('logits', 'float32', [-1, 10])\
        .with_output('classes', 'string', [-1, 1])

    monitoring = [
        sdk.Monitoring('Requests').with_spec('CounterMetricSpec', interval = 15),
        sdk.Monitoring('Latency').with_spec('LatencyMetricSpec', interval = 15),
        sdk.Monitoring('Accuracy').with_spec('AccuracyMetricSpec'),
        sdk.Monitoring('Autoencoder').with_health(True).with_spec('ImageAEMetricSpec', threshold=0.15, application='mnist-concept-app')
    ]

    model = sdk.Model()\
        .with_name(arguments['model_name'])\
        .with_runtime('hydrosphere/serving-runtime-tensorflow-1.13.1:latest')\
        .with_metadata(metadata)\
        .with_payload(payload)\
        .with_signature(signature)

    result = model.apply(arguments['hydrosphere_address'])
    print(result)

# i.  Upload the model to Hydrosphere Serving
github Hydrospheredata / kubeflow-workshop / 03_release / execute.py View on Github external
'epochs': arguments['epochs'],
        'batch_size': arguments['batch_size'],
        'accuracy': str(arguments['accuracy']),
        'data': arguments['data_path']
    }

    signature = sdk.Signature('predict')\
        .with_input('imgs', 'float32', [-1, 28, 28, 1], 'image')\
        .with_output('probabilities', 'float32', [-1, 10])\
        .with_output('class_ids', 'int64', [-1, 1])\
        .with_output('logits', 'float32', [-1, 10])\
        .with_output('classes', 'string', [-1, 1])

    monitoring = [
        sdk.Monitoring('Requests').with_spec('CounterMetricSpec', interval = 15),
        sdk.Monitoring('Latency').with_spec('LatencyMetricSpec', interval = 15),
        sdk.Monitoring('Accuracy').with_spec('AccuracyMetricSpec'),
        sdk.Monitoring('Autoencoder').with_health(True).with_spec('ImageAEMetricSpec', threshold=0.15, application='mnist-concept-app')
    ]

    model = sdk.Model()\
        .with_name(arguments['model_name'])\
        .with_runtime('hydrosphere/serving-runtime-tensorflow-1.13.1:latest')\
        .with_metadata(metadata)\
        .with_payload(payload)\
        .with_signature(signature)

    result = model.apply(arguments['hydrosphere_address'])
    print(result)

# i.  Upload the model to Hydrosphere Serving
# ii. Parse the status of the model uploading, retrieve the built 

hydrosdk

This package's purpose is to provide a simple and convenient way of integrating user's workflow scripts with Serving API.

Apache-2.0
Latest version published 3 years ago

Package Health Score

42 / 100
Full package analysis