Skip to content

Comments

[PR-1160]: Removed check for local usage#911

Merged
ackizilkale merged 5 commits intomasterfrom
PR-1160-inference-info-removal-for-local-runners
Feb 13, 2026
Merged

[PR-1160]: Removed check for local usage#911
ackizilkale merged 5 commits intomasterfrom
PR-1160-inference-info-removal-for-local-runners

Conversation

@srikanthbachala20
Copy link
Contributor

This pull request introduces improvements to how model configuration and inference compute information are handled, making the requirements for compute info explicit and ensuring consistency when initializing model-related classes. The changes add a new compute_info_required parameter to ModelBuilder, update dependent classes to accept and use an externally provided ModelBuilder, and enforce stricter validation when uploading models.

Improvements to model configuration and initialization:

  • Added a compute_info_required parameter to the ModelBuilder class and its initialization, allowing callers to specify if inference compute info is mandatory. The _get_inference_compute_info method now asserts the presence of this info when required and defaults to an empty dict if not present. [1] [2] [3] [4]
  • Updated the upload_model function and related tests to instantiate ModelBuilder with compute_info_required=True, enforcing that inference compute info must be present in these contexts. [1] [2]

Consistent usage of ModelBuilder across classes:

  • Modified ModelRunLocally and ModelServer to accept an optional ModelBuilder instance during initialization. If not provided, they create their own. This avoids redundant instantiation and ensures consistent configuration. [1] [2] [3]
  • Updated usage in the CLI (clarifai/cli/model.py) to pass the same ModelBuilder instance to both ModelRunLocally and ModelServer, ensuring shared configuration and avoiding unnecessary reloading or validation. [1] [2]

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request improves model configuration and initialization by making inference compute info requirements explicit and enabling ModelBuilder reuse across classes. The changes address a previous limitation where compute info was always required, which prevented local usage scenarios where this information is not needed.

Changes:

  • Added compute_info_required parameter to ModelBuilder to conditionally enforce inference compute info presence
  • Modified ModelServer and ModelRunLocally to accept an optional ModelBuilder instance, avoiding redundant instantiation
  • Updated CLI commands to pass shared ModelBuilder instances to both ModelRunLocally and ModelServer

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
clarifai/runners/models/model_builder.py Added compute_info_required parameter to control when inference compute info is mandatory; updated _get_inference_compute_info to conditionally assert and default to empty dict
clarifai/runners/server.py Added model_builder parameter to accept external ModelBuilder instance, avoiding redundant initialization
clarifai/runners/models/model_run_locally.py Added model_builder parameter to accept external ModelBuilder instance for consistency
clarifai/cli/model.py Updated to pass shared ModelBuilder instance to both ModelRunLocally and ModelServer
tests/runners/test_model_upload.py Updated test to use compute_info_required=True when testing upload flow
Comments suppressed due to low confidence (1)

clarifai/runners/server.py:154

  • The docstring is missing documentation for the new model_builder parameter. This parameter should be documented to explain its purpose and behavior, similar to how model_runner_local is documented.
        """Initialize the ModelServer.
        Args:
            model_path: Path to the model directory
            model_runner_local: ModelRunLocally instance (This is used to run the model locally with different modes like container or environment and patch it to Local Runner)
        """

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@ackizilkale
Copy link
Contributor

@copilot test fails with Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.12.12/x64/lib/python3.12/threading.py", line 1075, in _bootstrap_inner
self.run()
File "/opt/hostedtoolcache/Python/3.12.12/x64/lib/python3.12/threading.py", line 1012, in run
self._target(*self._args, **self._kwargs)
File "/home/runner/work/clarifai-python/clarifai-python/.venv/lib/python3.12/site-packages/clarifai_protocol/utils/health.py", line 67, in serve_health
File "/opt/hostedtoolcache/Python/3.12.12/x64/lib/python3.12/socketserver.py", line 457, in init
self.server_bind()
File "/opt/hostedtoolcache/Python/3.12.12/x64/lib/python3.12/http/server.py", line 136, in server_bind
socketserver.TCPServer.server_bind(self)
File "/opt/hostedtoolcache/Python/3.12.12/x64/lib/python3.12/socketserver.py", line 478, in server_bind
self.socket.bind(self.server_address)
TypeError: 'NoneType' object cannot be interpreted as an integer

Copy link
Contributor

Copilot AI commented Feb 13, 2026

@ackizilkale I've opened a new pull request, #946, to work on those changes. Once the pull request is ready, I'll request review from you.

@ackizilkale
Copy link
Contributor

@copilot why did you open a PR for this? Why did not you make the commit right in here?

Copy link
Contributor

Copilot AI commented Feb 13, 2026

@ackizilkale I've opened a new pull request, #947, to work on those changes. Once the pull request is ready, I'll request review from you.

@ackizilkale ackizilkale assigned Copilot and ackizilkale and unassigned Copilot Feb 13, 2026
ackizilkale and others added 3 commits February 13, 2026 09:17
Replace deprecated descriptor.label with descriptor.is_repeated in
serializers.py and protobuf.py to silence DeprecationWarnings. Fix
test_local_runner_cli mocks to return a list of objects with .name
attributes (matching actual MethodSignature protocol) instead of a
plain dict, and update ModelServer assertion to include model_builder.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link

Code Coverage

Package Line Rate Health
clarifai 45%
clarifai.cli 67%
clarifai.cli.templates 46%
clarifai.client 65%
clarifai.client.auth 67%
clarifai.constants 100%
clarifai.datasets 100%
clarifai.datasets.export 80%
clarifai.datasets.upload 75%
clarifai.datasets.upload.loaders 37%
clarifai.models 100%
clarifai.modules 0%
clarifai.rag 0%
clarifai.runners 52%
clarifai.runners.models 64%
clarifai.runners.pipeline_steps 41%
clarifai.runners.pipelines 77%
clarifai.runners.utils 62%
clarifai.runners.utils.data_types 72%
clarifai.schema 100%
clarifai.urls 60%
clarifai.utils 60%
clarifai.utils.evaluation 16%
clarifai.workflows 95%
Summary 61% (9950 / 16238)

Minimum allowed line rate is 50%

@ackizilkale ackizilkale merged commit 85b26e5 into master Feb 13, 2026
11 checks passed
@ackizilkale ackizilkale deleted the PR-1160-inference-info-removal-for-local-runners branch February 13, 2026 14:57
@ackizilkale ackizilkale mentioned this pull request Feb 13, 2026
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants