Skip to content

Conversation

@Nic-Ma
Copy link
Contributor

@Nic-Ma Nic-Ma commented Jan 6, 2022

Fixes #3482 .

Description

Develop the complete prototype of model package in this branch as @wyli suggested: #3518 (comment).
Then split into smaller PRs for review.

Status

Work in progress

Types of changes

  • Non-breaking change (fix or new feature that would not break existing functionality).
  • Breaking change (fix or new feature that would cause existing functionality to change).
  • New tests added to cover the changes.
  • Integration tests passed locally by running ./runtests.sh -f -u --net --coverage.
  • Quick tests passed locally by running ./runtests.sh --quick --unittests --disttests.
  • In-line docstrings updated.
  • Documentation updated, tested make html command in the docs/ folder.

* [DLMED] add ConfigParser

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] add more doc-string

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] add unit tests

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] fix CI error

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] fix test error

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] skip for windows

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] fix windows test

Signed-off-by: Nic Ma <nma@nvidia.com>
@Nic-Ma Nic-Ma changed the title [WIP] 3482 Develop necessary components for the model package MVP [WIP] 3482 Develop components for the model package MVP Jan 6, 2022
Nic-Ma added 11 commits January 17, 2022 10:42
Signed-off-by: Nic Ma <nma@nvidia.com>
Signed-off-by: Nic Ma <nma@nvidia.com>
Signed-off-by: Nic Ma <nma@nvidia.com>
Signed-off-by: Nic Ma <nma@nvidia.com>
Signed-off-by: Nic Ma <nma@nvidia.com>
Signed-off-by: Nic Ma <nma@nvidia.com>
Signed-off-by: Nic Ma <nma@nvidia.com>
@Nic-Ma
Copy link
Contributor Author

Nic-Ma commented Jan 24, 2022

/black

@Nic-Ma
Copy link
Contributor Author

Nic-Ma commented Jan 24, 2022

/build

@Nic-Ma
Copy link
Contributor Author

Nic-Ma commented Jan 24, 2022

/black

@Nic-Ma
Copy link
Contributor Author

Nic-Ma commented Jan 24, 2022

/build

Signed-off-by: Nic Ma <nma@nvidia.com>
@Nic-Ma
Copy link
Contributor Author

Nic-Ma commented Jan 24, 2022

/black

@Nic-Ma
Copy link
Contributor Author

Nic-Ma commented Jan 24, 2022

/build

@Nic-Ma
Copy link
Contributor Author

Nic-Ma commented Jan 26, 2022

/build

Nic-Ma and others added 2 commits January 27, 2022 16:07
Signed-off-by: Nic Ma <nma@nvidia.com>
@ericspod
Copy link
Member

The config parsing code looks good to me, submitting that separately to be integrated now separate from the other concepts here would work.

@Nic-Ma
Copy link
Contributor Author

Nic-Ma commented Jan 28, 2022

The config parsing code looks good to me, submitting that separately to be integrated now separate from the other concepts here would work.

Hi @ericspod ,

Thanks for your review.
I started to split the features into smaller and clearer PRs for easier review and update, the first one is: #3720.
It's not urgent to merge it, please review and discuss the solution within team.

Thanks in advance.

@Nic-Ma
Copy link
Contributor Author

Nic-Ma commented Jan 28, 2022

Hi @ericspod ,

BTW, do you know any other solutions in other projects that parse / construct python instances from JSON / YAML config?
I see something related:
https://github.com/cwacek/python-jsonschema-objects
https://pynative.com/python-convert-json-data-into-custom-python-object/
Maybe we can refer to them for unknown ideas or verify this current solution.

Thanks in advance.

@ericspod
Copy link
Member

ericspod commented Jan 28, 2022

Hi @ericspod ,

BTW, do you know any other solutions in other projects that parse / construct python instances from JSON / YAML config? I see something related: https://github.com/cwacek/python-jsonschema-objects https://pynative.com/python-convert-json-data-into-custom-python-object/ Maybe we can refer to them for unknown ideas or verify this current solution.

Thanks in advance.

These solutions are about creating new types or objects without classes from JSON. What I think we need is just a way to instantiate existing classes based on a name to find the right class and the values for constructor arguments given as JSON. Given a schema like

{
    "object_type" : "foo.bar.baz",
    "arguments" : {
        "arg1":1,
        "arg2":[0,1,2]
    }
}

This would be interpreted as creating a new object of type baz taken from the module foo.bar. We can use importlib.import_module to load foo.bar, extract the member baz from it, then instantiate with baz(arg1=1,arg2=[0,1,2]). We can do this recursively if arguments are objects rather than literals or JSON structures, but we are still somewhat limited by the possible values JSON provides.

@Nic-Ma
Copy link
Contributor Author

Nic-Ma commented Jan 28, 2022

Hi @ericspod ,

Thanks for your explanation, I think your idea aligns with my proposal in this PR.
I will involve more guys to take a look and start to review the first separate PR: #3720.

Thanks.

Signed-off-by: Nic Ma <nma@nvidia.com>
Signed-off-by: Nic Ma <nma@nvidia.com>
Signed-off-by: Nic Ma <nma@nvidia.com>
Signed-off-by: Nic Ma <nma@nvidia.com>
Signed-off-by: Nic Ma <nma@nvidia.com>
Signed-off-by: Nic Ma <nma@nvidia.com>
Signed-off-by: Nic Ma <nma@nvidia.com>
Signed-off-by: Nic Ma <nma@nvidia.com>
Signed-off-by: Nic Ma <nma@nvidia.com>
Signed-off-by: Nic Ma <nma@nvidia.com>
Signed-off-by: Nic Ma <nma@nvidia.com>
@wyli
Copy link
Contributor

wyli commented Mar 15, 2022

closing this one as the major part is now merged into dev, the others are tracked here #3482

@wyli wyli closed this Mar 15, 2022
@wyli wyli deleted the 3482-mmar-mvp branch March 16, 2022 14:21
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.

Develop MVP of model bundle

4 participants