Skip to content

Error while using Model.Save() #6281

@ML-pixel

Description

@ML-pixel

System Information (please complete the following information):

  • Checked on multiple systems (win 10, win 2019,2021 server)

  • ML.NET Version: ML.NET 1.7.0

  • .NET Core 2.2.3

Describe the bug
When saving trained model of very large size, xx GB the exception is thrown with the inner exception "The length cannot be greater than the capacity. ParameterName valueCount at System.Text.StringBuilder.Append() at Microsoft.Ml.Data.ReadOnlyMemoryUtils.AppendSpan ...etc
What I think is that the Save() uses StringBuilder.Append(char*,Int32) method and the int32 is a problem.

To Reproduce
1.Train extra large model
2.Try to save it with Model.Save()

error_Cut

Activity

ghost added
untriagedNew issue has not been triaged
on Aug 10, 2022
added
bugSomething isn't working
and removed
untriagedNew issue has not been triaged
on Aug 22, 2022
dakersnar

dakersnar commented on Aug 22, 2022

@dakersnar
Contributor

@luisquintanilla It seems like this API is limiting the model size as intended, but there doesn't seem to be a workaround for users who want to save a large model. Is this functionality we need to add to ML.NET, or is there an alternative API I'm missing?

luisquintanilla

luisquintanilla commented on Aug 25, 2022

@luisquintanilla
Contributor

There is no alternative API that I'm aware of.

@ML-pixel do you experience these issues on newer versions of .NET? (i.e. .NET 6)

ML-pixel

ML-pixel commented on Sep 2, 2022

@ML-pixel
Author

There is no alternative API that I'm aware of.

@ML-pixel do you experience these issues on newer versions of .NET? (i.e. .NET 6)

I will check it, but it's not a solution becasue it will make me upgrade production and I'm not sure if its possible right now.

ML-pixel

ML-pixel commented on Sep 30, 2022

@ML-pixel
Author

@luisquintanilla I've tested it on .net 6 and the issue is still the same.
@dakersnar Is there a chance it will be fixed anytime soon?

added this to the ML.NET Future milestone on Oct 11, 2022
luisquintanilla

luisquintanilla commented on Oct 11, 2022

@luisquintanilla
Contributor

@ML-pixel thanks for confirming this is also the case on .NET 6. Do you know more or less how large your model is?

@dakersnar let's investigate and see what could be causing this. I added it to the ML.NET Future milestone for now. I suspect some of the new deep learning models might run into similar issues.

ML-pixel

ML-pixel commented on Oct 17, 2022

@ML-pixel
Author

@ML-pixel thanks for confirming this is also the case on .NET 6. Do you know more or less how large your model is?

@dakersnar let's investigate and see what could be causing this. I added it to the ML.NET Future milestone for now. I suspect some of the new deep learning models might run into similar issues.

Well, for sure the zip file that was created just before crash was above 25 GB, the RAM consumption is around 400 GB.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @dakersnar@luisquintanilla@ML-pixel

        Issue actions

          Error while using Model.Save() · Issue #6281 · dotnet/machinelearning