Skip to content
This repository was archived by the owner on Nov 16, 2023. It is now read-only.

Using Local ML.NET Binaries With NimbusML

pieths edited this page Aug 6, 2019 · 12 revisions
  1. Increase the versions in your_mlnet_root\build\BranchInfo.props. The versions of the ml.net libraries only need to be increased high enough so that nuget will not be able to find the specific version any where but on your local machine. In the example below, the version was increased from 1.2.0 -> 1.3.0 and 0.14.0 -> 0.15.0. See nuget.org for the latest published versions of the ml.net libraries.

      <PropertyGroup Condition="'$(IsStableProject)' == 'true'">
        <MajorVersion>1</MajorVersion>
        <MinorVersion>3</MinorVersion>
        <PatchVersion>0</PatchVersion>
        <PreReleaseLabel>preview</PreReleaseLabel>
      </PropertyGroup>
      <PropertyGroup Condition="'$(IsStableProject)' != 'true'">
        <MajorVersion>0</MajorVersion>
        <MinorVersion>15</MinorVersion>
        <PatchVersion>0</PatchVersion>
        <PreReleaseLabel>preview</PreReleaseLabel>
      </PropertyGroup>
  2. Build ml.net.

    1. Clean out the repository. This step is optional.

      git clean -fxd

      If there are issues when running the above command, this might be because there are programs which are actively using some of the files that are trying to be deleted. Try closing Visual Studio and stopping with End task in Task Manager any of its worker services which may be running in the background.

    2. Build the libraries.

      build -release
    3. Create the nuget packages out of the libraries built in step (2). Some users have reported requiring -release as an additional argument to to the build command to produce release nuget packages.

      build -buildPackages
  3. Add the local nuget package directory created in step (2.iii) to your_nimbusml_root\nuget.config.

      <packageSources>
        <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
        <!-- COMMENT THIS OUT
        <add key="MlNet_Daily" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
        -->
        <add key="local_mlnet" value="your_mlnet_root\bin\packages" /> <!-- ADD THIS LINE -->
      </packageSources>
  4. Update the versions in the DotNetBridge project file your_nimbusml_root\src\DotNetBridge\DotNetBridge.csproj to match the versions of the packages created in step (2). Note: the version values require the -preview suffix to be recognized by nuget.

    <PackageReference Include="Microsoft.ML" Version="1.3.0-preview" />
    <PackageReference Include="Microsoft.ML.CpuMath" Version="1.3.0-preview" />    
    <PackageReference Include="Microsoft.ML.EntryPoints" Version="0.15.0-preview" />
    <PackageReference Include="Microsoft.ML.Mkl.Components" Version="1.3.0-preview" />
    <PackageReference Include="Microsoft.ML.Mkl.Redist" Version="1.3.0-preview" />
    <PackageReference Include="Microsoft.ML.ImageAnalytics" Version="1.3.0-preview" />
    <PackageReference Include="Microsoft.ML.LightGBM" Version="1.3.0-preview" />
    <PackageReference Include="Microsoft.ML.OnnxTransformer" Version="1.3.0-preview" />
    <PackageReference Include="Microsoft.ML.TensorFlow" Version="1.3.0-preview" />
    <PackageReference Include="Microsoft.ML.Ensemble" Version="0.15.0-preview" />
    <PackageReference Include="Microsoft.ML.TimeSeries" Version="1.3.0-preview" />
  5. Update the versions in your_nimbusml_root\src\Platforms\build.csproj to match the versions of the packages created in step (2). Note: the version values require the -preview suffix to be recognized by nuget.

    <PackageReference Include="Microsoft.ML" Version="1.3.0-preview" />
    <PackageReference Include="Microsoft.ML.CpuMath" Version="1.3.0-preview" />    
    <PackageReference Include="Microsoft.ML.EntryPoints" Version="0.15.0-preview" />
    <PackageReference Include="Microsoft.ML.Mkl.Components" Version="1.3.0-preview" />
    <PackageReference Include="Microsoft.ML.ImageAnalytics" Version="1.3.0-preview" />
    <PackageReference Include="Microsoft.ML.LightGBM" Version="1.3.0-preview" />
    <PackageReference Include="Microsoft.ML.OnnxTransformer" Version="1.3.0-preview" />
    <PackageReference Include="Microsoft.ML.TensorFlow" Version="1.3.0-preview" />
    <PackageReference Include="Microsoft.ML.Ensemble" Version="0.15.0-preview" />
    <PackageReference Include="Microsoft.ML.TimeSeries" Version="1.3.0-preview" />
  6. Build NimbusML and run the tests.

    1. Clean out the repository. This step is optional but recommended to make sure all the previous binaries have been discarded.

      git clean -fxd

      If there are issues when running the above command, this might be because there are programs which are actively using some of the files that are trying to be deleted. Try closing Visual Studio and stopping with End task in Task Manager any of its worker services (ie. Visual Studio - Python background analyzer) which may be running in the background.

    2. Build NimbusML.

      build --runTests

Notes

  • To remove the nuget cache, remove the .nuget folder in the home directory.

  • To verify that NimbusML is using the ml.net binaries that were built locally, right click on any one of Microsoft.ML.*.dll in your_nimbusml_root\dependencies\Python3.7\Lib\site-packages\nimbusml\internal\libs and select properties->details. The details page should show the updated version of the library (corresponding to step (1)) and it should also show that the library was built locally.

Clone this wiki locally