Sunday, April 28, 2024 3:43:37 PM

Error Creating Model: Could not load System.Runtime.CompilerServices.Unsafe

one year ago
#17 Quote
Using the free trial, first attempted training run with 3 signals, I get an error creating model. Please advise. Logs:

[code]
5/22/2022 11:19 AM | CL 06-22 | Deep Signal Library Version 1.1.2.371
5/22/2022 11:19 AM | CL 06-22 | Could not find NinjaTrader Version
5/22/2022 11:19 AM | CL 06-22 | Found valid license
5/22/2022 11:19 AM | CL 06-22 | Checking for newer Deep Signal Library version.
5/22/2022 11:19 AM | CL 06-22 | Creating Data File for CL 06-22
5/22/2022 11:19 AM | CL 06-22 | Creating data folder C:\Users\ja\Documents\NinjaTrader 8\Deep Signal Data\CL 06-22 5-22-2022 11.19 AM
5/22/2022 11:19 AM | CL 06-22 |
5/22/2022 11:19 AM | CL 06-22 | Begin generating data..
5/22/2022 11:19 AM | CL 06-22 | Done reading data for CL 06-22
5/22/2022 11:20 AM | CL 06-22 | Waiting to extract sequence data for CL 06-22
5/22/2022 11:20 AM | CL 06-22 | Cleansing data for CL 06-22
5/22/2022 11:20 AM | CL 06-22 | Saving data to file for CL 06-22
5/22/2022 11:20 AM | CL 06-22 | Writing data file at C:\Users\ja\Documents\NinjaTrader 8\Deep Signal Data\CL 06-22 5-22-2022 11.19 AM\Deep Signal.MLData.txt from 4/19/2022 to 5/13/2022
5/22/2022 11:20 AM | CL 06-22 | Setting maximum vals to 2x current max and minimum to 0,
5/22/2022 11:20 AM | CL 06-22 | Saving model params at C:\Users\ja\Documents\NinjaTrader 8\Deep Signal Data\CL 06-22 5-22-2022 11.19 AM\Deep Signal.MLData.ModelParams.xml
5/22/2022 11:20 AM | CL 06-22 |   Primary Instrument = CL 06-22 (1 Minute bars)
5/22/2022 11:20 AM | CL 06-22 |   Window Size = 1
5/22/2022 11:20 AM | CL 06-22 |   Strategy Name = JasonCreateModelTest0
5/22/2022 11:20 AM | CL 06-22 |   Ticks Up To Target = 5
5/22/2022 11:20 AM | CL 06-22 |   Ticks Down To Target = 5
5/22/2022 11:20 AM | CL 06-22 |   Use Stop = True
5/22/2022 11:20 AM | CL 06-22 |   Stop (Ticks) = 7
5/22/2022 11:20 AM | CL 06-22 |   Use Open Or Close = Close
5/22/2022 11:20 AM | CL 06-22 |   Don't Predict Next Day = True
5/22/2022 11:20 AM | CL 06-22 |   Binary Classification Metric = F1Score
5/22/2022 11:20 AM | CL 06-22 |   Max Create Model Time = 5 minutes
5/22/2022 11:20 AM | CL 06-22 |   Use Directory Cache = False
5/22/2022 11:20 AM | CL 06-22 |   Data Start Date = 4/19/2022
5/22/2022 11:20 AM | CL 06-22 |   Data End Date = 5/13/2022
5/22/2022 11:20 AM | CL 06-22 |   Indicator Parameters:
5/22/2022 11:20 AM | CL 06-22 |     s1, decimal precision = 0 decimal places
5/22/2022 11:20 AM | CL 06-22 |     s2, decimal precision = 0 decimal places
5/22/2022 11:20 AM | CL 06-22 |     s3, decimal precision = 0 decimal places
5/22/2022 11:20 AM | CL 06-22 |   Additional Instruments:
5/22/2022 11:20 AM | CL 06-22 |     CL 06-22, Market Data Type: Last, 1 Minute Bars
5/22/2022 11:20 AM | CL 06-22 | Normalizing Data
5/22/2022 11:20 AM | CL 06-22 | Found 1376 Short Profit Target Data Points
5/22/2022 11:20 AM | CL 06-22 | Found 1396 Long Profit Target Data Points
5/22/2022 11:20 AM | CL 06-22 | Found 424 Failed to Reach Profit Target Data Points
5/22/2022 11:20 AM | CL 06-22 | Training Machine Learning Model, Deep Signal Library Version 1.1.2.371
5/22/2022 11:20 AM | CL 06-22 | Using Auto-Train to train model. Maximum training time set at 5 minutes.
5/22/2022 11:20 AM | CL 06-22 |
5/22/2022 11:20 AM | CL 06-22 | Creating Model
5/22/2022 11:20 AM | CL 06-22 | Error Creating Model: Exception in AutoTrainLong Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified., Stack:    at System.Span`1..ctor(T[] array, Int32 start, Int32 length)
   at Microsoft.ML.Data.VBufferEditor`1..ctor(Int32 logicalLength, Int32 physicalValuesCount, T[] values, Int32[] indices, Boolean requireIndicesOnDense, Boolean createdNewValues, Boolean createdNewIndices)
      at Microsoft.ML.Data.VBuffer`1.GetEditor(Int32 newLogicalLength, Nullable`1 valuesCount, Nullable`1 maxValuesCapacit
0
one year ago
#18 Quote
... the rest of the stack trace from the log. It seems it got cutoff before:

5/22/2022 11:20 AM | CL 06-22 | Error Creating Model: Exception in AutoTrainLong Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified., Stack:    at System.Span`1..ctor(T[] array, Int32 start, Int32 length)
   at Microsoft.ML.Data.VBufferEditor`1..ctor(Int32 logicalLength, Int32 physicalValuesCount, T[] values, Int32[] indices, Boolean requireIndicesOnDense, Boolean createdNewValues, Boolean createdNewIndices)
   at Microsoft.ML.Data.VBuffer`1.GetEditor(Int32 newLogicalLength, Nullable`1 valuesCount, Nullable`1 maxValuesCapacity, Boolean keepOldOnResize, Boolean requireIndicesOnDense)
   at Microsoft.ML.Data.DataViewConstructionUtils.InputRowBase`1.<>c__DisplayClass16_0`1.<CreateDirectArrayGetterDelegate>b__0(VBuffer`1& dst)
   at Microsoft.ML.AutoML.DatasetDimensionsUtil.HasMissingNumericVector(IDataView data, Column column)
   at Microsoft.ML.AutoML.DatasetDimensionsApi.CalcColumnDimensions(MLContext context, IDataView data, Column[] purposes)
   at Microsoft.ML.AutoML.DatasetColumnInfoUtil.GetDatasetColumnInfo(MLContext context, IDataView data, ColumnInformation columnInfo)
   at Microsoft.ML.AutoML.ExperimentBase`2.ExecuteCrossValSummary(IDataView[] trainDatasets, ColumnInformation columnInfo, IDataView[] validationDatasets, IEstimator`1 preFeaturizer, IProgress`1 progressHandler)
   at Microsoft.ML.AutoML.ExperimentBase`2.Execute(IDataView trainData, ColumnInformation columnInformation, IEstimator`1 preFeaturizer, IProgress`1 progressHandler)
   at DST.Library.LSTMSequenceClassifier.‮‬‫‎‏‍‎‌‭‍‎‬‍‌‬‏​‭‏‭​‬‭‭‮(‌‭​‌‮​​‮‍‍‭‎‎‭‭‏‏‭‎‏‭‮ , BackgroundWorker , DoWorkEventArgs )
5/22/2022 11:20 AM | CL 06-22 | Error Creating Short Model: Exception in AutoTrainShort Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified., Stack:    at System.Span`1..ctor(T[] array, Int32 start, Int32 length)
   at Microsoft.ML.Data.VBufferEditor`1..ctor(Int32 logicalLength, Int32 physicalValuesCount, T[] values, Int32[] indices, Boolean requireIndicesOnDense, Boolean createdNewValues, Boolean createdNewIndices)
   at Microsoft.ML.Data.VBuffer`1.GetEditor(Int32 newLogicalLength, Nullable`1 valuesCount, Nullable`1 maxValuesCapacity, Boolean keepOldOnResize, Boolean requireIndicesOnDense)
   at Microsoft.ML.Data.DataViewConstructionUtils.InputRowBase`1.<>c__DisplayClass16_0`1.<CreateDirectArrayGetterDelegate>b__0(VBuffer`1& dst)
   at Microsoft.ML.AutoML.DatasetDimensionsUtil.HasMissingNumericVector(IDataView data, Column column)
   at Microsoft.ML.AutoML.DatasetDimensionsApi.CalcColumnDimensions(MLContext context, IDataView data, Column[] purposes)
   at Microsoft.ML.AutoML.DatasetColumnInfoUtil.GetDatasetColumnInfo(MLContext context, IDataView data, ColumnInformation columnInfo)
   at Microsoft.ML.AutoML.ExperimentBase`2.ExecuteCrossValSummary(IDataView[] trainDatasets, ColumnInformation columnInfo, IDataView[] validationDatasets, IEstimator`1 preFeaturizer, IProgress`1 progressHandler)
   at Microsoft.ML.AutoML.ExperimentBase`2.Execute(IDataView trainData, ColumnInformation columnInformation, IEstimator`1 preFeaturizer, IProgress`1 progressHandler)
   at DST.Library.LSTMSequenceClassifier.‪‮‭​‬‍‮‏‪‮‫‮‭‪‮‮‬‪‍​‌‏‮(‌‭​‌‮​​‮‍‍‭‎‎‭‭‏‏‭‎‏‭‮ , BackgroundWorker , DoWorkEventArgs )
5/22/2022 11:20 AM |  | Exception in AutoTrainLong Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified., Stack:    at System.Span`1..ctor(T[] array,
0
one year ago
#19 Quote
(wow this is crappy forum software that doesn't let you past 109 lines? what????)

... the rest of the stack trace, trying again:

   at Microsoft.ML.Data.VBufferEditor`1..ctor(Int32 logicalLength, Int32 physicalValuesCount, T[] values, Int32[] indices, Boolean requireIndicesOnDense, Boolean createdNewValues, Boolean createdNewIndices)
   at Microsoft.ML.Data.VBuffer`1.GetEditor(Int32 newLogicalLength, Nullable`1 valuesCount, Nullable`1 maxValuesCapacity, Boolean keepOldOnResize, Boolean requireIndicesOnDense)
   at Microsoft.ML.Data.DataViewConstructionUtils.InputRowBase`1.<>c__DisplayClass16_0`1.<CreateDirectArrayGetterDelegate>b__0(VBuffer`1& dst)
   at Microsoft.ML.AutoML.DatasetDimensionsUtil.HasMissingNumericVector(IDataView data, Column column)
   at Microsoft.ML.AutoML.DatasetDimensionsApi.CalcColumnDimensions(MLContext context, IDataView data, Column[] purposes)
   at Microsoft.ML.AutoML.DatasetColumnInfoUtil.GetDatasetColumnInfo(MLContext context, IDataView data, ColumnInformation columnInfo)
   at Microsoft.ML.AutoML.ExperimentBase`2.ExecuteCrossValSummary(IDataView[] trainDatasets, ColumnInformation columnInfo, IDataView[] validationDatasets, IEstimator`1 preFeaturizer, IProgress`1 progressHandler)
   at Microsoft.ML.AutoML.ExperimentBase`2.Execute(IDataView trainData, ColumnInformation columnInformation, IEstimator`1 preFeaturizer, IProgress`1 progressHandler)
   at DST.Library.LSTMSequenceClassifier.‪‮‭​‬‍‮‏‪‮‫‮‭‪‮‮‬‪‍​‌‏‮(‌‭​‌‮​​‮‍‍‭‎‎‭‭‏‏‭‎‏‭‮ , BackgroundWorker , DoWorkEventArgs )
5/22/2022 11:20 AM |  | Exception in AutoTrainLong Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified., Stack:    at System.Span`1..ctor(T[] array, Int32 start, Int32 length)
   at Microsoft.ML.Data.VBufferEditor`1..ctor(Int32 logicalLength, Int32 physicalValuesCount, T[] values, Int32[] indices, Boolean requireIndicesOnDense, Boolean createdNewValues, Boolean createdNewIndices)
   at Microsoft.ML.Data.VBuffer`1.GetEditor(Int32 newLogicalLength, Nullable`1 valuesCount, Nullable`1 maxValuesCapacity, Boolean keepOldOnResize, Boolean requireIndicesOnDense)
   at Microsoft.ML.Data.DataViewConstructionUtils.InputRowBase`1.<>c__DisplayClass16_0`1.<CreateDirectArrayGetterDelegate>b__0(VBuffer`1& dst)
   at Microsoft.ML.AutoML.DatasetDimensionsUtil.HasMissingNumericVector(IDataView data, Column column)
   at Microsoft.ML.AutoML.DatasetDimensionsApi.CalcColumnDimensions(MLContext context, IDataView data, Column[] purposes)
   at Microsoft.ML.AutoML.DatasetColumnInfoUtil.GetDatasetColumnInfo(MLContext context, IDataView data, ColumnInformation columnInfo)
   at Microsoft.ML.AutoML.ExperimentBase`2.ExecuteCrossValSummary(IDataView[] trainDatasets, ColumnInformation columnInfo, IDataView[] validationDatasets, IEstimator`1 preFeaturizer, IProgress`1 progressHandler)
   at Microsoft.ML.AutoML.ExperimentBase`2.Execute(IDataView trainData, ColumnInformation columnInformation, IEstimator`1 preFeaturizer, IProgress`1 progressHandler)
   at DST.Library.LSTMSequenceClassifier.‮‬‫‎‏‍‎‌‭‍‎‬‍‌‬‏​‭‏‭​‬‭‭‮(‌‭​‌‮​​‮‍‍‭‎‎‭‭‏‏‭‎‏‭‮ , BackgroundWorker , DoWorkEventArgs )
5/22/2022 11:20 AM |  | Exception in AutoTrainShort Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified., Stack:    at System.Span`1..ctor(T[] array, Int32 start, Int32 length)
   at Microsoft.ML.Data.VBufferEditor`1..ctor(Int32 logicalLength, Int32 physicalValuesCount, T[] values, Int32[] indices, Boolean requireIndicesOnDense, Boolean createdNewValues, Boolean createdNewIndices)
   at Microsoft.ML.Data.VBuffer`1.GetEditor(Int32 newLogicalLength, Nullable`1 valuesCount, Nullable`1 maxValu
0
one year ago
#20 Quote
seems relevant:

https://stackoverflow.com/questions/62764744/could-not-load-file-or-assembly-system-runtime-compilerservices-unsafe


0
one year ago
#21 Quote
I tried opening Documents/NinjaTrader 8/bin/Custom in VisualStudio 2019 and running a NuGet install to obtain the missing package. No change. Still getting the CompilerServices not found error.

PM> Install-Package System.Runtime.CompilerServices.Unsafe -Version 4.5.3

Attempting to gather dependency information for package 'System.Runtime.CompilerServices.Unsafe.4.5.3' with respect to project 'NinjaTrader.Custom', targeting '.NETFramework,Version=v4.8'
Gathering dependency information took 264 ms
Attempting to resolve dependencies for package 'System.Runtime.CompilerServices.Unsafe.4.5.3' with DependencyBehavior 'Lowest'
Resolving dependency information took 0 ms
Resolving actions to install package 'System.Runtime.CompilerServices.Unsafe.4.5.3'
Resolved actions to install package 'System.Runtime.CompilerServices.Unsafe.4.5.3'
Retrieving package 'System.Runtime.CompilerServices.Unsafe 4.5.3' from 'nuget.org'.
Adding package 'System.Runtime.CompilerServices.Unsafe.4.5.3' to folder 'C:\Users\ja\Documents\NinjaTrader 8\bin\Custom\packages'
Added package 'System.Runtime.CompilerServices.Unsafe.4.5.3' to folder 'C:\Users\ja\Documents\NinjaTrader 8\bin\Custom\packages'
Added package 'System.Runtime.CompilerServices.Unsafe.4.5.3' to 'packages.config'
Successfully installed 'System.Runtime.CompilerServices.Unsafe 4.5.3' to NinjaTrader.Custom
Executing nuget actions took 1.03 sec
Time Elapsed: 00:00:01.4227235
PM>
0
one year ago
#22 Quote
I solved this with 2 steps:

a) In Visual Studio 2019, I opened the Documents/NinjaTrader 8/bin/Custom solution. In solution explorer, right click on the References -> Manage NuGet Packages...  and then install the System.Runtime.CompilerServices.Unsafe version 4.5.3

b) followed the first suggestion of https://stackoverflow.com/questions/62764744/could-not-load-file-or-assembly-system-runtime-compilerservices-unsafe  , namely:

1) Please try to register System.Runtime.CompilerServices.Unsafe version 4.0.4.1 into GAC so that the system can it.

Run Developer Command Prompt for VS2019 as Administrator

type:

cd xxxxx (the path of the the System.Runtime.CompilerServices.Unsafe 4.0.4.1)

gacutil /i System.Runtime.CompilerServices.Unsafe.dll


2) For my specific machine, this path, and the command output, was:

C:\Users\ja\Documents\NinjaTrader 8\bin\Custom\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461>dir
Volume in drive C is Windows
Volume Serial Number is 7AAD-3167

Directory of C:\Users\ja\Documents\NinjaTrader 8\bin\Custom\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461

05/22/2022  12:51 PM    <DIR>          .
05/22/2022  12:51 PM    <DIR>          ..
02/19/2020  11:05 AM            16,768 System.Runtime.CompilerServices.Unsafe.dll
02/19/2020  11:05 AM            14,080 System.Runtime.CompilerServices.Unsafe.xml
               2 File(s)         30,848 bytes
               2 Dir(s)  355,962,101,760 bytes free

C:\Users\ja\Documents\NinjaTrader 8\bin\Custom\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461> gacutil /i System.Runtime.CompilerServices.Unsafe.dll
Microsoft (R) .NET Global Assembly Cache Utility.  Version 4.0.30319.0
Copyright (c) Microsoft Corporation.  All rights reserved.

Assembly successfully added to the cache

C:\Users\ja\Documents\NinjaTrader 8\bin\Custom\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461>
0