ersilia-os / ersilia

The Ersilia Model Hub, a repository of AI/ML models for infectious and neglected disease research.
https://ersilia.io
GNU General Public License v3.0
203 stars 131 forks source link

[Project]: Better print in `ersilia info` #802

Closed miquelduranfrigola closed 1 week ago

miquelduranfrigola commented 1 year ago

Summary

At the moment, ersilia info prints redundant information JSON format. By default, we should see a nicer print in the terminal. An option --as_json could be added to keep the JSON functionality.

I have already created a placeholder class called InformationDisplayer that we can use to allow this functionality.

Scope

Initiative 🐋

Objective(s)

The goal is to simplify interaction with models through the CLI.

Team

No response

Timeline

No response

Documentation

No response

DhanshreeA commented 1 year ago

@miquelduranfrigola @GemmaTuron I can take this up since both of you are traveling right now?

miquelduranfrigola commented 1 year ago

Hi @DhanshreeA thanks for your message - let me give it a first go since I have some ideas in mind, which include new columns in AirTable and a better layout in the website, correspondinglyl (https://ersilia.io/model-hub). As soon as I have made some progress, I will let you know and we can take it from there! Sounds good?

miquelduranfrigola commented 1 year ago

For now, the output of ersilia info is something like this:

🚀 Molecular weight
The model is simply an implementation of the function Descriptors.MolWt of the chemoinformatics package RDKIT. It takes as input a small molecule (SMILES) and calculates its molecular weight in g/mol.

💁 Identifiers
Model identifiers: eos3b5e
Slug: molecular-weight

🤓 Code and parameters
GitHub: https://github.com/ersilia-os/eos3b5e
AWS S3: https://ersilia-models-zipped.s3.eu-central-1.amazonaws.com/eos3b5e.zip

🐋 Docker
Docker Hub: https://hub.docker.com/r/ersiliaos/eos3b5e
Architectures: AMD64,ARM64
GemmaTuron commented 9 months ago

@miquelduranfrigola please provide an update, should we tackle this issue or close it

miquelduranfrigola commented 9 months ago

Thanks @GemmaTuron - I think this is an interesting feature and I would not close the issue as yet.

I would like to leave it "on-hold" as we may want to display more information from AirTable, or do a more enriched (clickable) print. I do not have the capacity at the moment to work on it, though, so if you want to close the issue, feel free to do it!

DhanshreeA commented 7 months ago

This would definitely be quite useful. I can review this with you @miquelduranfrigola maybe in early March, when I have resolved higher priority issues.

GemmaTuron commented 1 week ago

Hi @DhanshreeA

We have discussed quite a while about the cli commands, info, catalog, can you summarise here the plan for the info command ?

DhanshreeA commented 1 week ago

@GemmaTuron presently I think this particular issue is redundant. There are, as I understand, two asks here:

  1. Nice print through the ersilia info command, which @miquelduranfrigola has implemented. This is how it presently looks if I run it on a served instance of eos3b5e:
🚀 Molecular weight
The model is simply an implementation of the function Descriptors.MolWt of the chemoinformatics package RDKIT. It takes as input a small molecule (SMILES) and calculates its molecular weight in g/mol.

💁 Identifiers
Model identifiers: eos3b5e
Slug: molecular-weight

🤓 Code and parameters
GitHub: https://github.com/ersilia-os/eos3b5e
AWS S3: https://ersilia-models-zipped.s3.eu-central-1.amazonaws.com/eos3b5e.zip

🐋 Docker
Docker Hub: https://hub.docker.com/r/ersiliaos/eos3b5e
Architectures: AMD64,ARM64
  1. The second ask is to have a way to serialize this as json through an as_json flag which outputs the following:
{
    "pack_mode": "conda",
    "service_class": "pulled_docker",
    "apis_list": [
        "run"
    ],
    "api_schema": {
        "run": {
            "input": {
                "key": {
                    "type": "string"
                },
                "input": {
                    "type": "string"
                },
                "text": {
                    "type": "string"
                }
            },
            "output": {
                "outcome": {
                    "type": "numeric_array",
                    "shape": [
                        1
                    ],
                    "meta": [
                        "value"
                    ]
                }
            }
        }
    },
    "size": 890.1454124450684,
    "metadata": {
        "Identifier": "eos3b5e",
        "Slug": "molecular-weight",
        "Status": "Ready",
        "Title": "Molecular weight",
        "Description": "The model is simply an implementation of the function Descriptors.MolWt of the chemoinformatics package RDKIT. It takes as input a small molecule (SMILES) and calculates its molecular weight in g/mol.\n",
        "Mode": "Pretrained",
        "Input": [
            "Compound"
        ],
        "Input Shape": "Single",
        "Task": [
            "Regression"
        ],
        "Output": [
            "Other value"
        ],
        "Output Type": [
            "Float"
        ],
        "Output Shape": "Single",
        "Interpretation": "Calculated molecular weight (g/mol)",
        "Tag": [
            "Molecular weight"
        ],
        "Publication": "https://www.rdkit.org/docs/RDKit_Book.html",
        "Source Code": "https://github.com/rdkit/rdkit",
        "License": "BSD-3.0",
        "Contributor": "miquelduranfrigola",
        "S3": "https://ersilia-models-zipped.s3.eu-central-1.amazonaws.com/eos3b5e.zip",
        "DockerHub": "https://hub.docker.com/r/ersiliaos/eos3b5e",
        "Docker Architecture": [
            "AMD64",
            "ARM64"
        ]
    },
    "card": {
        "Identifier": "eos3b5e",
        "Slug": "molecular-weight",
        "Status": "Ready",
        "Title": "Molecular weight",
        "Description": "The model is simply an implementation of the function Descriptors.MolWt of the chemoinformatics package RDKIT. It takes as input a small molecule (SMILES) and calculates its molecular weight in g/mol.\n",
        "Mode": "Pretrained",
        "Input": [
            "Compound"
        ],
        "Input Shape": "Single",
        "Task": [
            "Regression"
        ],
        "Output": [
            "Other value"
        ],
        "Output Type": [
            "Float"
        ],
        "Output Shape": "Single",
        "Interpretation": "Calculated molecular weight (g/mol)",
        "Tag": [
            "Molecular weight"
        ],
        "Publication": "https://www.rdkit.org/docs/RDKit_Book.html",
        "Source Code": "https://github.com/rdkit/rdkit",
        "License": "BSD-3.0",
        "Contributor": "miquelduranfrigola",
        "S3": "https://ersilia-models-zipped.s3.eu-central-1.amazonaws.com/eos3b5e.zip",
        "DockerHub": "https://hub.docker.com/r/ersiliaos/eos3b5e",
        "Docker Architecture": [
            "AMD64",
            "ARM64"
        ]
    }
}

This output is a combination of the model's card/metadata, and session information (ie service_class, model size, etc). It gives you more information than the pretty printing, and is a superset of what the ersilia card command outputs. ersilia card requires a model id to be given to it, whereas ersilia info dumps information for the currently running model. The fine distinction is that ersilia card will get you the card even for a model that is not on your system. This session information is also displayed as part of ersilia catalog --local --more.

Our plan is to remove ersilia card and bundle its functionality with ersilia catalog, in the following fashion ersilia catalog --card.

For now I think this issue can be closed, and I will open another one for reconciling the ersilia card and catalog commands.