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
# This examplemodel uses ProtoBuf input and output adapters class MyQwakModel(QwakModelInterface): def build(self): ... @qwak.api( input_adapter=ProtoInputAdapter(ModelInput), output_adapter=ProtoOutputAdapter() ) def predict(self, input_: ModelInput) -> ModelOutput: return ...
You can test the entire inference code, including input and output adapters, by calling the
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() output_.ParseFromString(result)
run_local method calls the following methods in a single command:
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() output_.ParseFromString(result)
Updated 4 months ago