Skip to content

Conversation

@rizzip
Copy link
Contributor

@rizzip rizzip commented May 8, 2025

Why

  • clarifai model predict fails due to additional args passed to predict_by*

How

  • Pass the compute args to the Model instead

Tests

  • The args error no longer appears and the call either waits for deployment or fails in other valid ways

Notes

@rizzip rizzip requested review from Copilot and luv-bansal May 8, 2025 21:04
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 PR fixes the Clarifai model predict functionality by ensuring that additional compute-related arguments are passed through to the Model constructor via a dedicated dictionary rather than directly into the predict methods.

  • Introduces a model_kwargs dictionary to group compute parameters.
  • Passes model_kwargs into Model instantiation for both URL-based and ID-based models.
  • Updates the pre-commit configuration by adding the debug-statements hook with a file exclusion.

Reviewed Changes

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

File Description
clarifai/cli/model.py Flows compute arguments through model_kwargs and removes them from predict_by_* calls.
.pre-commit-config.yaml Adds a new debug-statements pre-commit hook excluding tests/runners/test_model_signatures.py.

Comment on lines 699 to +713
if model_url:
model = Model(url=model_url, pat=ctx.obj['pat'], base_url=ctx.obj['base_url'])
model = Model(
url=model_url,
pat=ctx.obj.current.pat,
base_url=ctx.obj.current.api_base,
**model_kwargs,
)
else:
model = Model(
model_id=model_id,
user_id=user_id,
app_id=app_id,
pat=ctx.obj['pat'],
base_url=ctx.obj['base_url'],
pat=ctx.obj.current.pat,
base_url=ctx.obj.current.api_base,
**model_kwargs,
Copy link

Copilot AI May 8, 2025

Choose a reason for hiding this comment

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

[nitpick] The instantiation of Model in both branches (model_url and non-model_url) uses identical parameters (pat, base_url, and model_kwargs); consider refactoring to reduce duplication.

Copilot uses AI. Check for mistakes.
@github-actions
Copy link

github-actions bot commented May 8, 2025

Code Coverage

Package Line Rate Health
clarifai 43%
clarifai.cli 43%
clarifai.client 71%
clarifai.client.auth 74%
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 72%
clarifai.runners 10%
clarifai.runners.models 67%
clarifai.runners.utils 57%
clarifai.runners.utils.data_types 77%
clarifai.schema 100%
clarifai.urls 80%
clarifai.utils 74%
clarifai.utils.evaluation 67%
clarifai.workflows 94%
Summary 66% (5948 / 8946)

Minimum allowed line rate is 50%

@ackizilkale ackizilkale self-requested a review September 12, 2025 20:17
Copy link
Contributor

@luv-bansal luv-bansal left a comment

Choose a reason for hiding this comment

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

@srikanthbachala20 already fixed clarifai model predict CLI, I don't think we need this anymore. @rizzip I'm closing this PR

@luv-bansal luv-bansal closed this Sep 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants