Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Utilise model metadata to resolve model output type and shape #1184

Merged
merged 1 commit into from
Jul 3, 2024

Conversation

DhanshreeA
Copy link
Contributor

@DhanshreeA DhanshreeA commented Jul 3, 2024

Description

For models such as eos78ao (Mordred Descriptor), Ersilia is not able to resolve the model's datatype in its API schema to a numeric_array because of the presence of Null values for some of the descriptors in the model output. We know that the model outputs, in the ideal case, consist of only integer and float values, therefore the the datatype field should be set to numeric_array.

Changes

In this PR, a private method _get_schema_type_for_simple_run_api_case has been implemented to ascertain the model's output type and shape using model metadata fields such as Output Type and Output Shape. This method sets the field type in model's API schema to numeric_array, if Output Type is set to Float and Output Shape is set to List in the model's metadata. This implementation currently only covers a single model API case, ie, the run API.

Status

Before this change, the API schema for the model eos78ao looked as follows:

{
    "run": {
        "input": {
            "key": {
                "type": "string"
            },
            "input": {
                "type": "string"
            },
            "text": {
                "type": "string"
            }
        },
        "output": {
            "outcome": {
                "meta": [
                    "ABC",
                    "ABCGG",
                    "nAcid",
                    "nBase",
                    .....
                    "Zagreb2",
                    "mZagreb1",
                    "mZagreb2"
                ],
                "type": "null"
            }
        }
    }

After this change, the API schema looks as follows:

{
    "run": {
        "input": {
            "key": {
                "type": "string"
            },
            "input": {
                "type": "string"
            },
            "text": {
                "type": "string"
            }
        },
        "output": {
            "outcome": {
                "meta": [
                    "ABC",
                    "ABCGG",
                    "nAcid",
                    "nBase",
                    .....
                    "Zagreb2",
                    "mZagreb1",
                    "mZagreb2"
                ],
                "type": "numeric_array",
                "shape": [
                    1613
                ]
            }
        }
    }

This issue is related to ersilia-os/zaira-chem#42

…s currently only implemented for the single API (run)

case
@DhanshreeA DhanshreeA merged commit debe65e into master Jul 3, 2024
18 of 19 checks passed
@DhanshreeA DhanshreeA deleted the use-model-metadata-to-resolve-output-type branch July 3, 2024 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

1 participant