Running Models Locally

It is possible to easily run and debug your Qwak models locally.

Please make sure that you need to have the qwak-sdk installed in your local environment.


Debugging input and output adapters locally

Please Note: Calling the predict method locally does not trigger the input and output adapters.

To ensure successful local debugging, use the methods defined in this page.

Let's assume that you have the following model class, created an instance and executed the build method.

# This examplemodel uses ProtoBuf input and output adapters
class MyQwakModel(QwakModelInterface):

    def build(self):

    def predict(self, input_: ModelInput) -> ModelOutput:
			return ...

Running inference locally

You can test the entire inference code, including input and output adapters, by calling the execute function:

input_ = ModelInput(f1=0, f2=0).SerializeToString()

# The execute() calls the predict method with the input and output adapters
result = model.execute(input_)

output_ = ModelOutput()

Debugging the full model cycle

Running the run_local method calls the following methods in a single command:

  • build()
  • initialize_model()
  • predict()

The build and initialize_model functions are called during the first run_local run only.

# Create a local instance of your model
model = MyQwakModel()

input_ = ModelInput(f1=0, f2=0).SerializeToString()

# The run_local() method calls build(), initialize_model() and predict()
result = model.run_local(input_)

output_ = ModelOutput()