How to use the dtlpy.PackageFunction function in dtlpy

To help you get started, we’ve selected a few dtlpy 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 dataloop-ai / ZazuML / dataloop_services / push_deploy.py View on Github external
configs_input = dl.FunctionIO(type='Json', name='configs')
    time_input = dl.FunctionIO(type='Json', name='time')
    test_dataset_input = dl.FunctionIO(type='Json', name='test_dataset_id')
    query_input = dl.FunctionIO(type='Json', name='query')

    item_input = dl.FunctionIO(type='Item', name='item')
    model_input = dl.FunctionIO(type='Json', name='model_id')
    checkpoint_input = dl.FunctionIO(type='Json', name='checkpoint_id')

    predict_inputs = [dataset_input, val_query_input, checkpoint_path_input, model_specs_input]
    model_inputs = [dataset_input, train_query_input, val_query_input, hp_value_input, model_specs_input]
    zazu_inputs = [configs_input]

    predict_function = dl.PackageFunction(name='run', inputs=predict_inputs, outputs=[], description='')
    model_function = dl.PackageFunction(name='run', inputs=model_inputs, outputs=[], description='')
    zazu_search_function = dl.PackageFunction(name='search', inputs=zazu_inputs, outputs=[], description='')
    zazu_predict_function = dl.PackageFunction(name='predict', inputs=zazu_inputs, outputs=[], description='')
    timer_update_function = dl.PackageFunction(name='update_time', inputs=time_input, outputs=[], description='')
    predict_item_function = dl.PackageFunction(name='predict_single_item', inputs=[item_input], outputs=[],
                                               description='')
    load_checkpoint_function = dl.PackageFunction(name='load_new_inference_checkpoint',
                                                  inputs=[model_input, checkpoint_input], outputs=[],
                                                  description='')

    predict_module = dl.PackageModule(entry_point='dataloop_services/predict_module.py',
                                     name='predict_module',
                                     functions=[predict_function],
                                     init_inputs=[package_name_input])

    models_module = dl.PackageModule(entry_point='dataloop_services/trial_module.py',
                                     name='models_module',
                                     functions=[model_function],
github dataloop-ai / ZazuML / dataloop_services / push_deploy.py View on Github external
item_input = dl.FunctionIO(type='Item', name='item')
    model_input = dl.FunctionIO(type='Json', name='model_id')
    checkpoint_input = dl.FunctionIO(type='Json', name='checkpoint_id')

    predict_inputs = [dataset_input, val_query_input, checkpoint_path_input, model_specs_input]
    model_inputs = [dataset_input, train_query_input, val_query_input, hp_value_input, model_specs_input]
    zazu_inputs = [configs_input]

    predict_function = dl.PackageFunction(name='run', inputs=predict_inputs, outputs=[], description='')
    model_function = dl.PackageFunction(name='run', inputs=model_inputs, outputs=[], description='')
    zazu_search_function = dl.PackageFunction(name='search', inputs=zazu_inputs, outputs=[], description='')
    zazu_predict_function = dl.PackageFunction(name='predict', inputs=zazu_inputs, outputs=[], description='')
    timer_update_function = dl.PackageFunction(name='update_time', inputs=time_input, outputs=[], description='')
    predict_item_function = dl.PackageFunction(name='predict_single_item', inputs=[item_input], outputs=[],
                                               description='')
    load_checkpoint_function = dl.PackageFunction(name='load_new_inference_checkpoint',
                                                  inputs=[model_input, checkpoint_input], outputs=[],
                                                  description='')

    predict_module = dl.PackageModule(entry_point='dataloop_services/predict_module.py',
                                     name='predict_module',
                                     functions=[predict_function],
                                     init_inputs=[package_name_input])

    models_module = dl.PackageModule(entry_point='dataloop_services/trial_module.py',
                                     name='models_module',
                                     functions=[model_function],
                                     init_inputs=[package_name_input])

    zazu_module = dl.PackageModule(entry_point='dataloop_services/zazu_module.py',
                                   name='zazu_module',
                                   functions=[zazu_search_function, zazu_predict_function],
github dataloop-ai / ZazuML / dataloop_services / create_package.py View on Github external
def push_and_deploy_package(self, project, package_name):
    logger.info('dtlpy version:', dl.__version__)
    dataset_input = dl.FunctionIO(type='Dataset', name='dataset')
    hp_value_input = dl.FunctionIO(type='Json', name='hp_values')
    model_specs_input = dl.FunctionIO(type='Json', name='model_specs')
    init_specs_input = dl.FunctionIO(type='Json', name='package_name')
    input_to_init = {
        'package_name': package_name
    }

    inputs = [dataset_input, hp_value_input, model_specs_input]
    function = dl.PackageFunction(name='run', inputs=inputs, outputs=[], description='')
    module = dl.PackageModule(entry_point='dataloop_services/service_executor.py', name='service_executor',
                              functions=[function],
                              init_inputs=init_specs_input)

    package = project.packages.push(
        package_name=package_name,
        src_path=os.getcwd(),
        modules=[module])

    logger.info('deploying package . . .')
    self.service = package.services.deploy(service_name=package.name,
                                           module_name='service_executor',
                                           agent_versions={
                                               'dtlpy': '1.9.7',
                                               'runner': '1.9.7.latest',
                                               'proxy': '1.9.7.latest',
github dataloop-ai / ZazuML / dataloop_services / push_deploy.py View on Github external
package_name_input = dl.FunctionIO(type='Json', name='package_name')

    configs_input = dl.FunctionIO(type='Json', name='configs')
    time_input = dl.FunctionIO(type='Json', name='time')
    test_dataset_input = dl.FunctionIO(type='Json', name='test_dataset_id')
    query_input = dl.FunctionIO(type='Json', name='query')

    item_input = dl.FunctionIO(type='Item', name='item')
    model_input = dl.FunctionIO(type='Json', name='model_id')
    checkpoint_input = dl.FunctionIO(type='Json', name='checkpoint_id')

    predict_inputs = [dataset_input, val_query_input, checkpoint_path_input, model_specs_input]
    model_inputs = [dataset_input, train_query_input, val_query_input, hp_value_input, model_specs_input]
    zazu_inputs = [configs_input]

    predict_function = dl.PackageFunction(name='run', inputs=predict_inputs, outputs=[], description='')
    model_function = dl.PackageFunction(name='run', inputs=model_inputs, outputs=[], description='')
    zazu_search_function = dl.PackageFunction(name='search', inputs=zazu_inputs, outputs=[], description='')
    zazu_predict_function = dl.PackageFunction(name='predict', inputs=zazu_inputs, outputs=[], description='')
    timer_update_function = dl.PackageFunction(name='update_time', inputs=time_input, outputs=[], description='')
    predict_item_function = dl.PackageFunction(name='predict_single_item', inputs=[item_input], outputs=[],
                                               description='')
    load_checkpoint_function = dl.PackageFunction(name='load_new_inference_checkpoint',
                                                  inputs=[model_input, checkpoint_input], outputs=[],
                                                  description='')

    predict_module = dl.PackageModule(entry_point='dataloop_services/predict_module.py',
                                     name='predict_module',
                                     functions=[predict_function],
                                     init_inputs=[package_name_input])

    models_module = dl.PackageModule(entry_point='dataloop_services/trial_module.py',
github dataloop-ai / ZazuML / dataloop_services / push_deploy.py View on Github external
time_input = dl.FunctionIO(type='Json', name='time')
    test_dataset_input = dl.FunctionIO(type='Json', name='test_dataset_id')
    query_input = dl.FunctionIO(type='Json', name='query')

    item_input = dl.FunctionIO(type='Item', name='item')
    model_input = dl.FunctionIO(type='Json', name='model_id')
    checkpoint_input = dl.FunctionIO(type='Json', name='checkpoint_id')

    predict_inputs = [dataset_input, val_query_input, checkpoint_path_input, model_specs_input]
    model_inputs = [dataset_input, train_query_input, val_query_input, hp_value_input, model_specs_input]
    zazu_inputs = [configs_input]

    predict_function = dl.PackageFunction(name='run', inputs=predict_inputs, outputs=[], description='')
    model_function = dl.PackageFunction(name='run', inputs=model_inputs, outputs=[], description='')
    zazu_search_function = dl.PackageFunction(name='search', inputs=zazu_inputs, outputs=[], description='')
    zazu_predict_function = dl.PackageFunction(name='predict', inputs=zazu_inputs, outputs=[], description='')
    timer_update_function = dl.PackageFunction(name='update_time', inputs=time_input, outputs=[], description='')
    predict_item_function = dl.PackageFunction(name='predict_single_item', inputs=[item_input], outputs=[],
                                               description='')
    load_checkpoint_function = dl.PackageFunction(name='load_new_inference_checkpoint',
                                                  inputs=[model_input, checkpoint_input], outputs=[],
                                                  description='')

    predict_module = dl.PackageModule(entry_point='dataloop_services/predict_module.py',
                                     name='predict_module',
                                     functions=[predict_function],
                                     init_inputs=[package_name_input])

    models_module = dl.PackageModule(entry_point='dataloop_services/trial_module.py',
                                     name='models_module',
                                     functions=[model_function],
                                     init_inputs=[package_name_input])
github dataloop-ai / ZazuML / dataloop_services / push_deploy.py View on Github external
query_input = dl.FunctionIO(type='Json', name='query')

    item_input = dl.FunctionIO(type='Item', name='item')
    model_input = dl.FunctionIO(type='Json', name='model_id')
    checkpoint_input = dl.FunctionIO(type='Json', name='checkpoint_id')

    predict_inputs = [dataset_input, val_query_input, checkpoint_path_input, model_specs_input]
    model_inputs = [dataset_input, train_query_input, val_query_input, hp_value_input, model_specs_input]
    zazu_inputs = [configs_input]

    predict_function = dl.PackageFunction(name='run', inputs=predict_inputs, outputs=[], description='')
    model_function = dl.PackageFunction(name='run', inputs=model_inputs, outputs=[], description='')
    zazu_search_function = dl.PackageFunction(name='search', inputs=zazu_inputs, outputs=[], description='')
    zazu_predict_function = dl.PackageFunction(name='predict', inputs=zazu_inputs, outputs=[], description='')
    timer_update_function = dl.PackageFunction(name='update_time', inputs=time_input, outputs=[], description='')
    predict_item_function = dl.PackageFunction(name='predict_single_item', inputs=[item_input], outputs=[],
                                               description='')
    load_checkpoint_function = dl.PackageFunction(name='load_new_inference_checkpoint',
                                                  inputs=[model_input, checkpoint_input], outputs=[],
                                                  description='')

    predict_module = dl.PackageModule(entry_point='dataloop_services/predict_module.py',
                                     name='predict_module',
                                     functions=[predict_function],
                                     init_inputs=[package_name_input])

    models_module = dl.PackageModule(entry_point='dataloop_services/trial_module.py',
                                     name='models_module',
                                     functions=[model_function],
                                     init_inputs=[package_name_input])

    zazu_module = dl.PackageModule(entry_point='dataloop_services/zazu_module.py',
github dataloop-ai / ZazuML / dataloop_services / push_deploy.py View on Github external
configs_input = dl.FunctionIO(type='Json', name='configs')
    time_input = dl.FunctionIO(type='Json', name='time')
    test_dataset_input = dl.FunctionIO(type='Json', name='test_dataset_id')
    query_input = dl.FunctionIO(type='Json', name='query')

    item_input = dl.FunctionIO(type='Item', name='item')
    model_input = dl.FunctionIO(type='Json', name='model_id')
    checkpoint_input = dl.FunctionIO(type='Json', name='checkpoint_id')

    predict_inputs = [dataset_input, val_query_input, checkpoint_path_input, model_specs_input]
    model_inputs = [dataset_input, train_query_input, val_query_input, hp_value_input, model_specs_input]
    zazu_inputs = [configs_input]

    predict_function = dl.PackageFunction(name='run', inputs=predict_inputs, outputs=[], description='')
    model_function = dl.PackageFunction(name='run', inputs=model_inputs, outputs=[], description='')
    zazu_search_function = dl.PackageFunction(name='search', inputs=zazu_inputs, outputs=[], description='')
    zazu_predict_function = dl.PackageFunction(name='predict', inputs=zazu_inputs, outputs=[], description='')
    timer_update_function = dl.PackageFunction(name='update_time', inputs=time_input, outputs=[], description='')
    predict_item_function = dl.PackageFunction(name='predict_single_item', inputs=[item_input], outputs=[],
                                               description='')
    load_checkpoint_function = dl.PackageFunction(name='load_new_inference_checkpoint',
                                                  inputs=[model_input, checkpoint_input], outputs=[],
                                                  description='')

    predict_module = dl.PackageModule(entry_point='dataloop_services/predict_module.py',
                                     name='predict_module',
                                     functions=[predict_function],
                                     init_inputs=[package_name_input])

    models_module = dl.PackageModule(entry_point='dataloop_services/trial_module.py',
                                     name='models_module',
github dataloop-ai / ZazuML / dataloop_services / push_deploy.py View on Github external
test_dataset_input = dl.FunctionIO(type='Json', name='test_dataset_id')
    query_input = dl.FunctionIO(type='Json', name='query')

    item_input = dl.FunctionIO(type='Item', name='item')
    model_input = dl.FunctionIO(type='Json', name='model_id')
    checkpoint_input = dl.FunctionIO(type='Json', name='checkpoint_id')

    predict_inputs = [dataset_input, val_query_input, checkpoint_path_input, model_specs_input]
    model_inputs = [dataset_input, train_query_input, val_query_input, hp_value_input, model_specs_input]
    zazu_inputs = [configs_input]

    predict_function = dl.PackageFunction(name='run', inputs=predict_inputs, outputs=[], description='')
    model_function = dl.PackageFunction(name='run', inputs=model_inputs, outputs=[], description='')
    zazu_search_function = dl.PackageFunction(name='search', inputs=zazu_inputs, outputs=[], description='')
    zazu_predict_function = dl.PackageFunction(name='predict', inputs=zazu_inputs, outputs=[], description='')
    timer_update_function = dl.PackageFunction(name='update_time', inputs=time_input, outputs=[], description='')
    predict_item_function = dl.PackageFunction(name='predict_single_item', inputs=[item_input], outputs=[],
                                               description='')
    load_checkpoint_function = dl.PackageFunction(name='load_new_inference_checkpoint',
                                                  inputs=[model_input, checkpoint_input], outputs=[],
                                                  description='')

    predict_module = dl.PackageModule(entry_point='dataloop_services/predict_module.py',
                                     name='predict_module',
                                     functions=[predict_function],
                                     init_inputs=[package_name_input])

    models_module = dl.PackageModule(entry_point='dataloop_services/trial_module.py',
                                     name='models_module',
                                     functions=[model_function],
                                     init_inputs=[package_name_input])