Skip to content

Fix TypeError when accelerator_type is None in config.yaml#864

Merged
ackizilkale merged 1 commit intomasterfrom
fix/cpu-models
Dec 3, 2025
Merged

Fix TypeError when accelerator_type is None in config.yaml#864
ackizilkale merged 1 commit intomasterfrom
fix/cpu-models

Conversation

@ackizilkale
Copy link
Copy Markdown
Contributor

Root Cause

The _is_amd() method checks if the accelerator_type key exists but doesn't validate that its value is not None before attempting to iterate over it.

Solution

Added a null/empty check before iterating over accelerator_type:

  • Check if accelerator_type value is not None or empty
  • Only iterate if the value is a valid list/iterable
  • Gracefully handles cases where accelerator_type is explicitly set to null

Testing

  • Verified fix handles accelerator_type: null correctly
  • No errors when field is missing or empty
  • Normal GPU detection still works when valid values are provided

Impact

  • Users affected: Anyone uploading CPU-only models or models with accelerator_type: null in config.yaml
  • Severity: High - Command was completely broken for this use case
  • Risk: Low - Minimal change with proper null checking

Fixes the model upload workflow for CPU-only models.

- Add null check before iterating over accelerator_type
- Prevents 'NoneType' object is not iterable error during model upload
- Handles cases where accelerator_type is explicitly set to null in config
@ackizilkale ackizilkale requested review from a team and wemoveon2 December 3, 2025 18:36
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Dec 3, 2025

Code Coverage

Package Line Rate Health
clarifai 45%
clarifai.cli 60%
clarifai.cli.templates 46%
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 0%
clarifai.runners 52%
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 60%
clarifai.utils 59%
clarifai.utils.evaluation 67%
clarifai.workflows 95%
Summary 62% (8528 / 13676)

Minimum allowed line rate is 50%

@ackizilkale ackizilkale merged commit b74d44f into master Dec 3, 2025
16 of 17 checks passed
@ackizilkale ackizilkale deleted the fix/cpu-models branch December 3, 2025 19:37
@ackizilkale ackizilkale mentioned this pull request Dec 3, 2025
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.

2 participants