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

Typecheck known model types against their inputs and outputs #330

Open
Mohit0928 opened this issue Oct 1, 2021 · 1 comment
Open

Typecheck known model types against their inputs and outputs #330

Mohit0928 opened this issue Oct 1, 2021 · 1 comment
Labels
area - runefile The parsing and analysis of Runefiles category - enhancement New feature or request category - intuitiveness Something which may be unintuitive to the user or affect ergonomics good first issue Good for newcomers

Comments

@Mohit0928
Copy link

I'm typing the wrong input/output type and dimensions in the Runefile.yml, but even then, it's building a rune. @Michael-F-Bryan, It should throw an error if I write a wrong input/output type and dimension in the Runefile.yml. Below is an example:

Model info:

Inputs:
        serving_default_input:0: f32[1,192,192,3]
Outputs:
        StatefulPartitionedCall:0: f32[1,1,17,3]

Typing a wrong Runefile.yml:

version: 1
image: runicos/base

pipeline:
  image:
    capability: IMAGE
    outputs:
      - type: u8
        dimensions: [1,192,192,3]
    args:
      height: 192
      width: 192
      pixel-format: "@PixelFormat::RGB"
  normalizer:
    proc-block: "hotg-ai/rune#proc-blocks/image-normalization"
    inputs:
      - image
    outputs:
      - type: f32
        dimensions: [1,191,191,3]  #wrong output dimensions, it should be [1,192,192,3]
  pose:
    model: "./movenet_singlepose_lightning_3.tflite"
    inputs:
      - normalizer
    outputs:
      - type: u32             #wrong output type, it should be f32
        dimensions: [1,17,17,3]
  serial:
    out: SERIAL
    inputs:
      - pose
@Michael-F-Bryan Michael-F-Bryan changed the title Runefile.yml not checking input/output type and dimensions Typecheck known model types against their inputs and outputs Oct 1, 2021
@Michael-F-Bryan
Copy link
Contributor

This is something I'd like to do as well.

I've been reluctant to until now because it means the compiler frontend crate will now add TensorFlow Lite (either tflite or librunecoral) as a dependency... But that's a bloody big dependency and really hurts compile times if you want to just use the compiler frontend (e.g. Forge).

To implement this, during the "lowering" phase we need to associate models with minetypes based on the filename's extension. Then during the "typecheck" phase we need to add a pass which looks for TensorFlow Lite models, loads them, and checks input/output types.

@Michael-F-Bryan Michael-F-Bryan added area - runefile The parsing and analysis of Runefiles category - enhancement New feature or request category - intuitiveness Something which may be unintuitive to the user or affect ergonomics good first issue Good for newcomers labels Oct 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area - runefile The parsing and analysis of Runefiles category - enhancement New feature or request category - intuitiveness Something which may be unintuitive to the user or affect ergonomics good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants