dotnet / machinelearning

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

ModelFilePath within a .mbconfig file stores an absolute path, which prevents the project to work correctly if moved or cloned. #7191

Open vpenades opened 3 months ago

vpenades commented 3 months ago

System Information (please complete the following information):

Describe the bug

At the end of a training run using the ML wizard, a .mbconfig file is created.

That file contains an entry called "ModelFilePath:" which points to the .mlnet file, which happens to be in the same directory as the .mbconfig file.

But, I've noticed that "ModelFilePath:" holds the full, absolute file path to the model, instead of just the file name, or the relative path name.

This can cause trouble if the project is moved to another directory, or it is cloned in another machine.

To Reproduce

Just do some training using the wizard, and check the "ModelFilePath:" entry inside the .mbconfig and check whether it's an absolute or a relative path.

Expected behavior

"ModelFilePath:" should not be an absolute path.

LittleLittleCloud commented 3 months ago

@vpenades You can manually convert it to relative path (to .mbconfig) and the .mbconfig would still be able to load the resource. It's not documented but model builder processes this situation when path is relative.