Skip to content

Commit

Permalink
Minor adjustments to the example notebooks and tests (#864)
Browse files Browse the repository at this point in the history
* Minor adjustments to the example notebooks and tests

Since some of the upstream code re: shapes and sending requests changed in conjunction with the recent Dataloaders and Models changes, there are some small tweaks required to get the example tests passing again.

* Uncomment the `shutil.rmtree` clean-up
  • Loading branch information
karlhigley authored Mar 21, 2023
1 parent b2ddc3a commit 00aacf1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@
"df_lib = get_lib()\n",
"\n",
"import tritonclient.grpc as grpcclient\n",
"import nvtabular.inference.triton as nvt_triton"
"import merlin.systems.triton as merlin_triton\n",
"\n",
"import merlin.dtypes as md\n",
"from merlin.schema import ColumnSchema, Schema"
]
},
{
Expand Down Expand Up @@ -343,7 +346,12 @@
"metadata": {},
"outputs": [],
"source": [
"inputs = nvt_triton.convert_df_to_triton_input([\"userId\", \"movieId\"], batch, grpcclient.InferInput)\n",
"request_schema = Schema([\n",
" ColumnSchema(\"userId\", dtype=md.int64),\n",
" ColumnSchema(\"movieId\", dtype=md.int64),\n",
"])\n",
"\n",
"inputs = merlin_triton.convert_df_to_triton_input(request_schema, batch, grpcclient.InferInput)\n",
"\n",
"outputs = [\n",
" grpcclient.InferRequestedOutput(col)\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,11 @@ def test_func():
response = run_ensemble_on_tritonserver(
"/tmp/examples/poc_ensemble", ensemble.graph.input_schema, batch, outputs, "executor_model"
)
response = [x.tolist()[0] for x in response["ordered_ids"]]
ordered_ids = [x.tolist() for x in response["ordered_ids"]]
shutil.rmtree("/tmp/examples/", ignore_errors=True)
"""
)
tb2.execute_cell(NUM_OF_CELLS - 2)
response = tb2.ref("response")
assert len(response) == top_k
ordered_ids = tb2.ref("ordered_ids")

assert len(ordered_ids[0]) == top_k

0 comments on commit 00aacf1

Please sign in to comment.