dotnet / machinelearning

ML.NET is an open source and cross-platform machine learning framework for .NET.
https://dot.net/ml
MIT License
8.92k stars 1.86k forks source link

fix #6949 #6951

Closed LittleLittleCloud closed 5 months ago

LittleLittleCloud commented 5 months ago

We are excited to review your PR.

So we can do the best job, please check:

Fix #6949

ericstj commented 5 months ago

Interesting, the addition of SearchSpace sub-namespace now causes a type name resolution problem: https://github.com/dotnet/machinelearning/blob/d0d8569220da60ff8acde3650393110c54dea8d0/src/Microsoft.ML.TorchSharp/NasBert/Models/NasBertEncoder.cs#L258-L264

Looks like those were meant to refer to this internal class: https://github.com/dotnet/machinelearning/blob/d0d8569220da60ff8acde3650393110c54dea8d0/src/Microsoft.ML.TorchSharp/NasBert/Modules/SearchSpace.cs#L13

Maybe we just rename that @michaelgsharp?

codecov[bot] commented 5 months ago

Codecov Report

Attention: 33 lines in your changes are missing coverage. Please review.

Comparison is base (d0d8569) 68.80% compared to head (64a8a73) 68.80%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #6951 +/- ## ========================================== - Coverage 68.80% 68.80% -0.01% ========================================== Files 1249 1249 Lines 249644 249686 +42 Branches 25481 25485 +4 ========================================== + Hits 171778 171797 +19 - Misses 71275 71294 +19 - Partials 6591 6595 +4 ``` | [Flag](https://app.codecov.io/gh/dotnet/machinelearning/pull/6951/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dotnet) | Coverage Δ | | |---|---|---| | [Debug](https://app.codecov.io/gh/dotnet/machinelearning/pull/6951/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dotnet) | `68.80% <67.96%> (-0.01%)` | :arrow_down: | | [production](https://app.codecov.io/gh/dotnet/machinelearning/pull/6951/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dotnet) | `63.27% <67.96%> (-0.01%)` | :arrow_down: | | [test](https://app.codecov.io/gh/dotnet/machinelearning/pull/6951/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dotnet) | `88.41% <ø> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dotnet#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files](https://app.codecov.io/gh/dotnet/machinelearning/pull/6951?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dotnet) | Coverage Δ | | |---|---|---| | [...oft.ML.Core/SearchSpace/BoolearnChoiceAttribute.cs](https://app.codecov.io/gh/dotnet/machinelearning/pull/6951?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dotnet#diff-c3JjL01pY3Jvc29mdC5NTC5Db3JlL1NlYXJjaFNwYWNlL0Jvb2xlYXJuQ2hvaWNlQXR0cmlidXRlLmNz) | `100.00% <100.00%> (ø)` | | | [...c/Microsoft.ML.Core/SearchSpace/ChoiceAttribute.cs](https://app.codecov.io/gh/dotnet/machinelearning/pull/6951?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dotnet#diff-c3JjL01pY3Jvc29mdC5NTC5Db3JlL1NlYXJjaFNwYWNlL0Nob2ljZUF0dHJpYnV0ZS5jcw==) | `100.00% <100.00%> (ø)` | | | [...crosoft.ML.Core/SearchSpace/NestOptionAttribute.cs](https://app.codecov.io/gh/dotnet/machinelearning/pull/6951?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dotnet#diff-c3JjL01pY3Jvc29mdC5NTC5Db3JlL1NlYXJjaFNwYWNlL05lc3RPcHRpb25BdHRyaWJ1dGUuY3M=) | `100.00% <100.00%> (ø)` | | | [...oft.ML.TorchSharp/NasBert/Models/NasBertEncoder.cs](https://app.codecov.io/gh/dotnet/machinelearning/pull/6951?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dotnet#diff-c3JjL01pY3Jvc29mdC5NTC5Ub3JjaFNoYXJwL05hc0JlcnQvTW9kZWxzL05hc0JlcnRFbmNvZGVyLmNz) | `69.81% <66.66%> (ø)` | | | [src/Microsoft.ML.SearchSpace/SearchSpace.cs](https://app.codecov.io/gh/dotnet/machinelearning/pull/6951?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dotnet#diff-c3JjL01pY3Jvc29mdC5NTC5TZWFyY2hTcGFjZS9TZWFyY2hTcGFjZS5jcw==) | `82.18% <56.00%> (-2.97%)` | :arrow_down: | | [...rc/Microsoft.ML.Core/SearchSpace/RangeAttribute.cs](https://app.codecov.io/gh/dotnet/machinelearning/pull/6951?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dotnet#diff-c3JjL01pY3Jvc29mdC5NTC5Db3JlL1NlYXJjaFNwYWNlL1JhbmdlQXR0cmlidXRlLmNz) | `54.34% <54.34%> (ø)` | | ... and [1 file with indirect coverage changes](https://app.codecov.io/gh/dotnet/machinelearning/pull/6951/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dotnet)
michaelgsharp commented 5 months ago

@ericstj any classes directly involved in the TorchSharp model itself need to match names exactly with the name that was used to save the weights file. We could try and rename this file and see if things still load, but if its at all saved in the weights file its not a class that we can rename. I'll test that out and add a comment here about it.

michaelgsharp commented 5 months ago

/backport to release/3.0

github-actions[bot] commented 5 months ago

Started backporting to release/3.0: https://github.com/dotnet/machinelearning/actions/runs/7481061541

ericstj commented 5 months ago

any classes directly involved in the TorchSharp model itself need to match names exactly with the name that was used to save the weights file.

How would we be persisting the name of this static class in our saved file? Still might be worth renaming since we try to avoid name collisions in our codebases.