Skip to content

Instantly share code, notes, and snippets.

@rahuljantwal-8451
Created October 3, 2024 21:00
Show Gist options
  • Save rahuljantwal-8451/3d18a37ffbbb98e2d379191ec1584120 to your computer and use it in GitHub Desktop.
Save rahuljantwal-8451/3d18a37ffbbb98e2d379191ec1584120 to your computer and use it in GitHub Desktop.
Export the ensemble model to deploy on triton
from merlin.systems.dag.ops.workflow import TransformWorkflow
from merlin.systems.dag.ensemble import Ensemble
import nvtabular as nvt
import os
BASE_DIR = "."
if not os.path.isdir(os.path.join(BASE_DIR, 'ensemble')):
os.makedirs(os.path.join(BASE_DIR, 'ensemble'))
saved_workflow = nvt.Workflow.load('./data/simulated/processed_dataset')
user_graph = saved_workflow.get_subworkflow('user')
retrieval = ["col1", "col2"] >> TransformWorkflow(user_graph)
# define the path where all the models and config files exported to
export_path = os.path.join(BASE_DIR, 'ensemble')
ensemble = Ensemble(retrieval, user_graph.input_schema)
ens_config, node_configs = ensemble.export(export_path)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment