Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 25, 2025

Why

Platform specification was already supported in config.yaml via build_info.platform, but users had to edit the config file for each platform change. CLI override enables dynamic platform specification without file modifications.

How

  • Added --platform option to clarifai model upload command accepting single or comma-separated platform strings (e.g., "linux/amd64,linux/arm64")
  • Extended ModelBuilder.__init__() and upload_model() with optional platform: Optional[str] parameter
  • Modified get_model_version_proto() to prioritize CLI platform over config.yaml platform with explicit logging
  • CLI platform stored in _cli_platform attribute, checked before falling back to config

Priority order: CLI flag → config.yaml → no platform

Tests

  • Manual testing to verify platform parameter is passed correctly through the CLI to ModelBuilder
  • CodeQL security scan: 0 alerts
  • Skipped flaky tests that were causing CI failures:
    • test_list_workflows in tests/test_app.py
    • test_setup_correct, test_from_existing_workflow, test_predict_client_manage_state, test_upload_docs_filepath, test_upload_docs_from_url in tests/test_rag.py
    • test_text_embed_predict_with_raw_text, test_model_load_info in tests/test_model_predict.py

Notes

  • Backwards compatible: all parameters optional with None defaults
  • Type-safe: proper Optional[str] annotations throughout
  • Pipeline step upload could use similar treatment in future work

Usage:

# Override config.yaml platform clarifai model upload --platform "linux/amd64,linux/arm64" # Combine with other options clarifai model upload --platform "linux/arm64" --stage upload
Original prompt

We added config.yaml platform specification, we should also allow users to specify platform via CLI when uploading models


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits November 25, 2025 20:55
Co-authored-by: wemoveon2 <86081107+wemoveon2@users.noreply.github.com>
Co-authored-by: wemoveon2 <86081107+wemoveon2@users.noreply.github.com>
…ents Co-authored-by: wemoveon2 <86081107+wemoveon2@users.noreply.github.com>
Copilot AI changed the title [WIP] Add CLI option for platform specification when uploading models Add --platform CLI option for model upload Nov 25, 2025
Copilot AI requested a review from wemoveon2 November 25, 2025 21:07
Copilot finished work on behalf of wemoveon2 November 25, 2025 21:07
@wemoveon2
Copy link
Contributor

@copilot remove test

Co-authored-by: wemoveon2 <86081107+wemoveon2@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 25, 2025

@copilot remove test

Removed test_cli_platform_override test in commit 2d96143.

Copilot finished work on behalf of wemoveon2 November 25, 2025 22:28
@wemoveon2 wemoveon2 marked this pull request as ready for review November 26, 2025 16:30
@wemoveon2
Copy link
Contributor

@copilot =========================== short test summary info ============================
FAILED tests/test_app.py::TestApp::test_list_workflows - assert 8 == 10

  • where 8 = len([<clarifai.client.workflow.Workflow object at 0x10abfd950>, <clarifai.client.workflow.Workflow object at 0x10ad1b690>,...arifai.client.workflow.Workflow object at 0x10afd4e10>, <clarifai.client.workflow.Workflow object at 0x10af8f510>, ...])
    ERROR tests/test_rag.py::TestRAG::test_setup_correct - Exception: code: MODEL_DOES_NOT_EXIST
    description: "Model does not exist"
    details: "Model 'mistral-7B-Instruct' does not exist."
    req_id: "sdk-python-11.10.2-5e4411cc80de46c8bc1f87f15f0be115"
    ERROR tests/test_rag.py::TestRAG::test_from_existing_workflow - Exception: code: MODEL_DOES_NOT_EXIST
    description: "Model does not exist"
    details: "Model 'mistral-7B-Instruct' does not exist."
    req_id: "sdk-python-11.10.2-5e4411cc80de46c8bc1f87f15f0be115"
    ERROR tests/test_rag.py::TestRAG::test_predict_client_manage_state - Exception: code: MODEL_DOES_NOT_EXIST
    description: "Model does not exist"
    details: "Model 'mistral-7B-Instruct' does not exist."
    req_id: "sdk-python-11.10.2-5e4411cc80de46c8bc1f87f15f0be115"
    ERROR tests/test_rag.py::TestRAG::test_upload_docs_filepath - Exception: code: MODEL_DOES_NOT_EXIST
    description: "Model does not exist"
    details: "Model 'mistral-7B-Instruct' does not exist."
    req_id: "sdk-python-11.10.2-5e4411cc80de46c8bc1f87f15f0be115"
    ERROR tests/test_rag.py::TestRAG::test_upload_docs_from_url - Exception: code: MODEL_DOES_NOT_EXIST
    description: "Model does not exist"
    details: "Model 'mistral-7B-Instruct' does not exist."
    req_id: "sdk-python-11.10.2-5e4411cc80de46c8bc1f87f15f0be115"
    = 1 failed, 479 passed, 3 skipped, 151 warnings, 5 errors in 695.55s (0:11:35) =
Copy link
Contributor Author

Copilot AI commented Nov 26, 2025

@copilot =========================== short test summary info ============================
FAILED tests/test_app.py::TestApp::test_list_workflows - assert 8 == 10

  • where 8 = len([<clarifai.client....

This test failure in test_app.py::TestApp::test_list_workflows is unrelated to the platform CLI changes. My commits only modified clarifai/cli/model.py and clarifai/runners/models/model_builder.py, and didn't touch workflow listing functionality. The test expects 10 workflows but finds 8, which suggests a test environment or data setup issue rather than a code change issue.

Copilot finished work on behalf of wemoveon2 November 26, 2025 17:36
@wemoveon2
Copy link
Contributor

@copilot skip these tests

FAILED tests/test_app.py::TestApp::test_list_workflows - assert 8 == 10

  • where 8 = len([<clarifai.client.workflow.Workflow object at 0x10abfd950>, <clarifai.client.workflow.Workflow object at 0x10ad1b690>,...arifai.client.workflow.Workflow object at 0x10afd4e10>, <clarifai.client.workflow.Workflow object at 0x10af8f510>, ...])
    ERROR tests/test_rag.py::TestRAG::test_setup_correct - Exception: code: MODEL_DOES_NOT_EXIST
    description: "Model does not exist"
    details: "Model 'mistral-7B-Instruct' does not exist."
    req_id: "sdk-python-11.10.2-5e4411cc80de46c8bc1f87f15f0be115"
    ERROR tests/test_rag.py::TestRAG::test_from_existing_workflow - Exception: code: MODEL_DOES_NOT_EXIST
    description: "Model does not exist"
    details: "Model 'mistral-7B-Instruct' does not exist."
    req_id: "sdk-python-11.10.2-5e4411cc80de46c8bc1f87f15f0be115"
    ERROR tests/test_rag.py::TestRAG::test_predict_client_manage_state - Exception: code: MODEL_DOES_NOT_EXIST
    description: "Model does not exist"
    details: "Model 'mistral-7B-Instruct' does not exist."
    req_id: "sdk-python-11.10.2-5e4411cc80de46c8bc1f87f15f0be115"
    ERROR tests/test_rag.py::TestRAG::test_upload_docs_filepath - Exception: code: MODEL_DOES_NOT_EXIST
    description: "Model does not exist"
    details: "Model 'mistral-7B-Instruct' does not exist."
    req_id: "sdk-python-11.10.2-5e4411cc80de46c8bc1f87f15f0be115"
    ERROR tests/test_rag.py::TestRAG::test_upload_docs_from_url - Exception: code: MODEL_DOES_NOT_EXIST
    description: "Model does not exist"
    details: "Model 'mistral-7B-Instruct' does not exist."
    req_id: "sdk-python-11.10.2-5e4411cc80de46c8bc1f87f15f0be115"
Co-authored-by: wemoveon2 <86081107+wemoveon2@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 26, 2025

@copilot skip these tests

FAILED tests/test_app.py::TestApp::test_list_workflows - assert 8 == 10
...

Skipped the flaky test_list_workflows test in commit 587470c.

@wemoveon2
Copy link
Contributor

@copilot also skip test_setup_correct test_from_existing_workflow test_predict_client_manage_state test_upload_docs_filepath test_upload_docs_from_url

Copilot finished work on behalf of wemoveon2 November 26, 2025 22:55
Co-authored-by: wemoveon2 <86081107+wemoveon2@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 26, 2025

@copilot also skip test_setup_correct test_from_existing_workflow test_predict_client_manage_state test_upload_docs_filepath test_upload_docs_from_url

Skipped test_setup_correct, test_from_existing_workflow, test_predict_client_manage_state, test_upload_docs_filepath, and test_upload_docs_from_url in commit e5d1cae.

Copilot finished work on behalf of wemoveon2 November 26, 2025 22:59
@wemoveon2
Copy link
Contributor

@copilot skip
tests/test_model_predict.py::TestModelPredict::test_text_embed_predict_with_raw_text
tests/test_model_predict.py::TestModelPredict::test_model_load_info

Co-authored-by: wemoveon2 <86081107+wemoveon2@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 26, 2025

@copilot skip
tests/test_model_predict.py::TestModelPredict::test_text_embed_predict_with_raw_text
tests/test_model_predict.py::TestModelPredict::test_model_load_info

Skipped test_text_embed_predict_with_raw_text and test_model_load_info in commit a2283b8.

Copilot finished work on behalf of wemoveon2 November 26, 2025 23:37
@wemoveon2 wemoveon2 enabled auto-merge (squash) November 26, 2025 23:37
@github-actions
Copy link

Code Coverage

Package Line Rate Health
clarifai 45%
clarifai.cli 45%
clarifai.cli.templates 33%
clarifai.client 67%
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 17%
clarifai.runners 53%
clarifai.runners.models 62%
clarifai.runners.pipeline_steps 41%
clarifai.runners.pipelines 77%
clarifai.runners.utils 62%
clarifai.runners.utils.data_types 72%
clarifai.schema 100%
clarifai.urls 58%
clarifai.utils 59%
clarifai.utils.evaluation 67%
clarifai.workflows 95%
Summary 61% (8321 / 13602)

Minimum allowed line rate is 50%

@wemoveon2 wemoveon2 merged commit 16ed1e1 into master Nov 26, 2025
11 checks passed
@wemoveon2 wemoveon2 deleted the copilot/add-cli-platform-specification branch November 26, 2025 23:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants