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

Modified how DataViewTypes are registered #4187

Merged
merged 6 commits into from
Sep 13, 2019
Merged

Modified how DataViewTypes are registered #4187

merged 6 commits into from
Sep 13, 2019

Conversation

bpstark
Copy link
Contributor

@bpstark bpstark commented Sep 7, 2019

The DataViewManager registers DataViewTypes to determine how to
represent the the data within ML.Net. However, there was a bug in how
types were being queried. Types that were being registered via an
Attribute were being added to the manager with only that Attribute.
However, when queried from the manager all custom Attributes were being
passed.
To solve this we need to only pass custom Attributes that are relevant
to the Manager. All Type attributes now inherit from a single
TypeAttribute class such that we can filter custom attributes for
relevant types.

Fixes #4121

The DataViewManager registers DataViewTypes to determine how to
represent the the data within ML.Net. However, there was a bug in how
types were being queried. Types that were being registered via an
Attribute were being added to the manager with only that Attribute.
However, when queried from the manager all custom Attributes were being
passed.
To solve this we need to only pass custom Attributes that are relevant
to the Manager. All Type attributes now inherit from a single
TypeAttribute class such that we can filter custom attributes for
relevant types.
@bpstark bpstark requested a review from a team as a code owner September 7, 2019 00:13
@dnfclas
Copy link

dnfclas commented Sep 7, 2019

CLA assistant check
All CLA requirements met. #Resolved

@eerhardt
Copy link
Member

eerhardt commented Sep 9, 2019

We should use the scenario from #4121 to test whether this change fixes the problem. Use an [OnnxSequenceType] attribute with a [ColumnName] attribute and make sure you can execute the ONNX file correctly. #Resolved

@bpstark
Copy link
Contributor Author

bpstark commented Sep 9, 2019

@eerhardt The tests added here do capture the issue of #4121, I have simply reduced the issue down to its simplest forms to make it a unit testable component. #Resolved

Since the DataViewManager works only on DataViewTypeAttributes, we do
not need to subclass attributes, but only the filter on the
DataViewTypeAttribute instead.
@eerhardt
Copy link
Member

eerhardt commented Sep 9, 2019

I have simply reduced the issue down to its simplest forms

There are things that can go wrong when doing that.

  1. The reduced scenario may not represent the original issue accurately.
  2. There may be more issues that need fixing in the original scenario than just the reduced first issue hit.
  3. In the future, someone may add/change code in the product that would break the original scenario, but not your reduced scenario test.

In a case like this, capturing the original scenario in a test case to ensure it is fixed, and prevent future regressions, is ideal. #Resolved

While the unit test added previously addressed the underlying issue,
this test case proves that the issue in Bug #4121 is now completely
resolved, and there should be no further issues.
Did not want to polute the repo with large models so was able to find an
existing model which had an appropriate output such that we could still
verify the same behavior.
Brian Stark added 2 commits September 10, 2019 12:15
Since the the register function is part of the public API we cannot
remove/change it. However, I have marked that form of the call to be
obsolete, and instead have created a new register API which takes in
only a singular DataViewTypeAttribute. This will allow us to keep
existing functionality while still providing guidance on how the API
should actually be used. Once we increment the major version of the API
we can then remove the obsoleted version of register.
While working locally, the test were not working on the CI job. this
appeared to be due to issues with path for the model, as well as not
using OnnxFact.
@eerhardt
Copy link
Member

eerhardt commented Sep 12, 2019

@wschin - can you comment on the changes? What were the scenarios necessary for having an Enumerable of attributes?

Looking at #3263 (the original PR) I assume it has to do with you can have multiple ImageTypeAttributes with different height and width values.

@bpstark, Can you explain why you made that change to the API? #Resolved

@bpstark
Copy link
Contributor Author

bpstark commented Sep 12, 2019

@eerhardt According to the usage the only types which are ever passed to the DataViewManager register function are subclassed from DataViewTypeAttribute. according to the schema doc which @yaeldekel referenced we are only allowed to ever have at most 1 DataViewTypeAttribute associated with a given member var. As such we can never have more than 1 attribute passed to the register function. #Resolved

@eerhardt
Copy link
Member

eerhardt commented Sep 12, 2019

Sounds fine to me. Please make sure @wschin signs off on this change, since he has the full background. #Resolved

@bpstark
Copy link
Contributor Author

bpstark commented Sep 12, 2019

@wschin could you please take a look at my change. #Resolved

@bpstark bpstark merged commit 34cfdfb into dotnet:master Sep 13, 2019
@bpstark bpstark deleted the bug4121 branch September 13, 2019 20:43
@ghost ghost locked as resolved and limited conversation to collaborators Mar 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using OnnxSequenceType and ColumnName attributes together doesn't work
5 participants