How to use the dtlpy.PackageModule 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
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],
                                   init_inputs=package_name_input)

    zazu_timer_module = dl.PackageModule(entry_point='dataloop_services/zazu_timer_module.py',
                                         name='zazu_timer_module',
                                         functions=[timer_update_function],
                                         init_inputs=[configs_input, time_input, test_dataset_input, query_input])
    predict_item_module = dl.PackageModule(entry_point='dataloop_services/prediction_module.py',
                                           name='predict_item_module',
                                           functions=[predict_item_function, load_checkpoint_function],
github dataloop-ai / ZazuML / dataloop_services / push_deploy.py View on Github external
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],
                                   init_inputs=package_name_input)

    zazu_timer_module = dl.PackageModule(entry_point='dataloop_services/zazu_timer_module.py',
                                         name='zazu_timer_module',
                                         functions=[timer_update_function],
                                         init_inputs=[configs_input, time_input, test_dataset_input, query_input])
    predict_item_module = dl.PackageModule(entry_point='dataloop_services/prediction_module.py',
                                           name='predict_item_module',
                                           functions=[predict_item_function, load_checkpoint_function],
                                           init_inputs=[model_input, checkpoint_input])
    package_obj = project.packages.push(
        package_name='zazuml',
        src_path=os.getcwd(),
        modules=[predict_module, models_module, zazu_module, zazu_timer_module, predict_item_module])

    return package_obj
github dataloop-ai / ZazuML / dataloop_services / push_deploy.py View on Github external
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],
                                   init_inputs=package_name_input)

    zazu_timer_module = dl.PackageModule(entry_point='dataloop_services/zazu_timer_module.py',
                                         name='zazu_timer_module',
github dataloop-ai / ZazuML / dataloop_services / push_deploy.py View on Github external
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],
                                   init_inputs=package_name_input)

    zazu_timer_module = dl.PackageModule(entry_point='dataloop_services/zazu_timer_module.py',
                                         name='zazu_timer_module',
                                         functions=[timer_update_function],
                                         init_inputs=[configs_input, time_input, test_dataset_input, query_input])
    predict_item_module = dl.PackageModule(entry_point='dataloop_services/prediction_module.py',
                                           name='predict_item_module',
                                           functions=[predict_item_function, load_checkpoint_function],
                                           init_inputs=[model_input, checkpoint_input])
    package_obj = project.packages.push(
        package_name='zazuml',
        src_path=os.getcwd(),
        modules=[predict_module, models_module, zazu_module, zazu_timer_module, predict_item_module])
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',
                                               'verify': True
github dataloop-ai / ZazuML / dataloop_services / push_deploy.py View on Github external
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],
                                   init_inputs=package_name_input)

    zazu_timer_module = dl.PackageModule(entry_point='dataloop_services/zazu_timer_module.py',
                                         name='zazu_timer_module',
                                         functions=[timer_update_function],
                                         init_inputs=[configs_input, time_input, test_dataset_input, query_input])
    predict_item_module = dl.PackageModule(entry_point='dataloop_services/prediction_module.py',
                                           name='predict_item_module',
                                           functions=[predict_item_function, load_checkpoint_function],
                                           init_inputs=[model_input, checkpoint_input])
    package_obj = project.packages.push(
        package_name='zazuml',
        src_path=os.getcwd(),
        modules=[predict_module, models_module, zazu_module, zazu_timer_module, predict_item_module])

    return package_obj