Skip to content

Default values read from JSON are always strings in the Azure ML Command #8

@GrannyProgramming

Description

@GrannyProgramming

Description:

When using the azure.ai.ml.command to create components from a JSON file, the default values are always interpreted as strings, even when the original data type in the JSON is a number. This causes issues when the components require numerical default values.

Details:

System/Environment details:
Operating System: Linux (Github actions
Python version: python 3.9
azure.ai.ml version: @latest (Installed at runtime)

Steps to reproduce:
Define a component in a JSON file with an input that has a numerical default value.
Use azure.ai.ml.command to create the component from the JSON.
Print the created component or use it in a pipeline.

Expected behavior:
The default value should preserve its original numerical data type.

Actual behavior:
The default value is always a string.

Workarounds attempted:
Explicit Conversion: The default value was explicitly converted to a number after it was read from the JSON file. Despite this conversion, the default value was still being outputted as a string. This suggests that the conversion was not preserved, possibly due to the way the Input class or the serialization process treats the default values.

Type Conversion Check: In the set_default_value function, there was a check to see if the default value was a string that could be converted to a float or an integer. If it could be, it was converted. However, the final output still showed the default value as a string, suggesting that this conversion was not preserved.
Impact:
This issue prevents the correct execution of pipelines that require numerical default values for their inputs.

Labels:

bug, AzureML, AML components

Related commits/branches:

1ec93a0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions