dotnet / dotnet/machinelearning
File path and/or name are too long when saving training model.
- Dominant language
- C#
- Stars
- 9.4k
- Forks
- 2k
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 11
Description
**System Information (please complete the following information):**
- OS & Version: Windows 10
- ML.NET Version: ML.Net v1.4 & ML.Net 1.7
- .NET Version: .Net Framework 4.7.2 - ASP.Net
**Describe the bug**
When saving a training model in a ASP.Net web application the following error is returned.
`System.IO.PathTooLongException
HResult=0x800700CE
Message=The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
Source=mscorlib
StackTrace:
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.Directory.InternalCreateDirectory(String fullPath, String path, Object dirSecurityObj, Boolean checkHost)
at System.IO.Directory.InternalCreateDirectoryHelper(String path, Boolean checkHost)
at Microsoft.ML.Repository.GetPath(String& pathEnt, String& pathTemp, String dir, String name, Boolean createDir)
at Microsoft.ML.RepositoryWriter.CreateEntry(String dir, String name)
at Microsoft.ML.ModelSaveContext..ctor(RepositoryWriter rep, String dir, String name)
at Microsoft.ML.ModelSaveContext.SaveSubModel(String dir, Action1 fn)
at Microsoft.ML.Transforms.NormalizingTransformer.SaveModel(ModelSaveContext ctx)
at Microsoft.ML.ModelSaveContext.SaveModel[T](RepositoryWriter rep, T value, String path)
at Microsoft.ML.Data.TransformerChain1.Microsoft.ML.ICanSaveModel.Save(ModelSaveContext ctx)
at Microsoft.ML.ModelSaveContext.SaveModel[T](RepositoryWriter rep, T value, String path)
at Microsoft.ML.Data.TransformerChain1.Microsoft.ML.ICanSaveModel.Save(ModelSaveContext ctx)
at Microsoft.ML.ModelSaveContext.SaveModel[T](RepositoryWriter rep, T value, String path)
at Microsoft.ML.Data.TransformerChain1.Microsoft.ML.ICanSaveModel.Save(ModelSaveContext ctx)
at Microsoft.ML.ModelSaveContext.SaveModel[T](RepositoryWriter rep, T value, String path)
at Microsoft.ML.Data.TransformerChain1.Microsoft.ML.ICanSaveModel.Save(ModelSaveContext ctx)
at Microsoft.ML.ModelSaveContext.SaveModel[T](RepositoryWriter rep, T value, String path)
at Microsoft.ML.Data.TransformerChain1.Microsoft.ML.ICanSaveModel.Save(ModelSaveContext ctx)
at Microsoft.ML.ModelSaveContext.SaveModel[T](RepositoryWriter rep, T value, String path)
at Microsoft.ML.Data.TransformerChain1.Microsoft.ML.ICanSaveModel.Save(ModelSaveContext ctx)
at Microsoft.ML.ModelSaveContext.SaveModel[T](RepositoryWriter rep, T value, String path)
at Microsoft.ML.Data.TransformerChain1.Microsoft.ML.ICanSaveModel.Save(ModelSaveContext ctx)
at Microsoft.ML.ModelSaveContext.SaveModel[T](RepositoryWriter rep, T value, String path)
at Microsoft.ML.Data.TransformerChain1.Microsoft.ML.ICanSaveModel.Save(ModelSaveContext ctx)
at Microsoft.ML.ModelSaveContext.SaveModel[T](RepositoryWriter rep, T value, String path)
at Microsoft.ML.Data.TransformerChain1.Microsoft.ML.ICanSaveModel.Save(ModelSaveContext ctx)
at Microsoft.ML.ModelSaveContext.SaveModel[T](RepositoryWriter rep, T value, String path)
at Microsoft.ML.Data.TransformerChain1.Microsoft.ML.ICanSaveModel.Save(ModelSaveContext ctx)
at Microsoft.ML.ModelSaveContext.SaveModel[T](RepositoryWriter rep, T value, String path)
at Microsoft.ML.Data.TransformerChain1.Microsoft.ML.ICanSaveModel.Save(ModelSaveContext ctx)
at Microsoft.ML.ModelSaveContext.SaveModel[T](RepositoryWriter rep, T value, String path)
at Microsoft.ML.Data.TransformerChain1.Microsoft.ML.ICanSaveModel.Save(ModelSaveContext ctx)
at Microsoft.ML.ModelSaveContext.SaveModel[T](RepositoryWriter rep, T value, String path)
at Microsoft.ML.Data.TransformerChain1.Microsoft.ML.ICanSaveModel.Save(ModelSaveContext ctx)
at Microsoft.ML.ModelSaveContext.SaveModel[T](RepositoryWriter rep, T value, String path)
at Microsoft.ML.Data.TransformerChain1.Microsoft.ML.ICanSaveModel.Save(ModelSaveContext ctx)
at Microsoft.ML.ModelSaveContext.SaveModel[T](RepositoryWriter rep, T value, String path)
at Microsoft.ML.ModelOperationsCatalog.Save(ITransformer model, DataViewSchema inputSchema, Stream stream)
at Microsoft.ML.ModelOperationsCatalog.Save(ITransformer model, DataViewSchema inputSchema, String filePath)
at TPTestWeb.index.Page_Load(Object sender, EventArgs e) in C:\Users\Andy\source\repos\TPTest\TPTestWeb\index.aspx.cs:line 96
This exception was originally thrown at this call stack:
[External Code]
TPTestWeb.index.Page_Load(object, System.EventArgs) in index.aspx.cs
[External Code]`
However the same code in a console application works fine. The error happens if I try to save to either a file or a memory stream.
**To Reproduce**
To reproduce please see the example solution I have linked to below. It contains both an example console and ASP.Net application.
**Expected behavior**
The training model zip file to be saved.
**Screenshots, Code, Sample Projects**
https://github.com/XactaAndy/TPTest
Contributor guide
Assessment
This issue has not been assessed yet.