Skip to content

Instantly share code, notes, and snippets.

@geoffreyangus
Last active November 21, 2022 21:16
Show Gist options
  • Save geoffreyangus/4e0ecf9c6718170664efd7e0600fb61f to your computer and use it in GitHub Desktop.
Save geoffreyangus/4e0ecf9c6718170664efd7e0600fb61f to your computer and use it in GitHub Desktop.
Method 1: Using the `InferenceModule` Class
from pprint import pprint
import pandas as pd
from ludwig.models.inference import InferenceModule
inference_module = InferenceModule.from_directory(
f"{EXPERIMENT_DIRECTORY}/torchscript")
input_df = pd.read_parquet(f"{DATA_DIRECTORY}/twitter_bots.parquet")
input_sample_df = input_df.head(2)
postproc_output, _ = inference_module.predict(input_sample_df, return_type=dict)
pprint(postproc_output)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment