From 04ad137417f977f4174a5a7f72551485076a4a3a Mon Sep 17 00:00:00 2001 From: Foke Singh Date: Mon, 9 Jan 2023 17:05:09 +0000 Subject: [PATCH] Update howto_torch2zml docs to explain why the `output` variable can be `None`. --- docs/howtos/howto_torch2zml.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/howtos/howto_torch2zml.md b/docs/howtos/howto_torch2zml.md index 00e8a5c..ef16c0e 100644 --- a/docs/howtos/howto_torch2zml.md +++ b/docs/howtos/howto_torch2zml.md @@ -90,7 +90,11 @@ prompt = "Q: What is the largest animal?\nA:" # so let's stop collecting after 1000 layers. pipeline = zml_utils.ActivationCollector(pipeline, max_layers=1000, stop_after_first_step=True) output, activations = pipeline(prompt) -print(output) + +# `output` can be `None` if activations collection +# has stopped before the end of the inference +if output: + print(output) # Save activations to a file. filename = model_path.split("/")[-1] + ".activations.pt"