From 6e0b799e8c391b092d842498337e2683ba2f7001 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 25 Nov 2025 19:53:55 +0000 Subject: [PATCH] Fix: Prevent TypeError during model version creation When uploading a model, the `get_model_version_proto` function in `clarifai/runners/models/model_builder.py` gathers method signatures to include in the model version protobuf. For older, "proto-style" methods, the signature is intentionally set to `None`. This `None` value was being passed to the `resources_pb2.ModelVersion` constructor, which expects a `MethodSignature` object, resulting in a `TypeError`. This change filters out any `None` values from the list of signatures before they are used, ensuring that only valid `MethodSignature` objects are passed to the protobuf constructor. --- clarifai/runners/models/model_builder.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/clarifai/runners/models/model_builder.py b/clarifai/runners/models/model_builder.py index 11e41fe5..1d988cf8 100644 --- a/clarifai/runners/models/model_builder.py +++ b/clarifai/runners/models/model_builder.py @@ -792,7 +792,9 @@ def get_method_signatures(self, mocking=True): """ model_class = self.load_model_class(mocking=mocking) method_infos = model_class._get_method_infos() - signatures = [method.signature for method in method_infos.values()] + signatures = [ + method.signature for method in method_infos.values() if method.signature is not None + ] return signatures @property