Open some-guy1 opened 6 years ago
Ok FYI, I rolled back my version of R to 3.4.4, then I downloaded and reinstalled the Mxnet that was compiled with R 3.4.4 for windows. Everything works as expected with 3.4.4 including the super simple tutorial.
So, something definitely changed with R 3.5, but unfortunately I dont think I am knowledgeable enough to know what it is. :-/
More details would be needed. I run R 3.5.0 using the compiled Winodws libraries (mxnet 1.2.0) and the FiveMinutes tutorial runs without issue. The demo.metric.mae however won't work as the metrics are calculated on ndarrays rather than R arrays.
Hmm ok. When I get some free time I will try and hunt down why 3.5 is not working. Lots of changes with 3.5, so I guess I shouldnt be surprised.
Thanks for the quick response! I will report back soon.
Ok you gave me a very big hint with the metrics and the change from R arrays to ndarrays.
Yes, the FiveMinutes tutorial works except for the custom metric.
My personal code was NOT using a custom metric, BUT it is using a custom loss function. The new metrics (not custom) are not playing nicely with the custom loss. I kept getting errors about array sizes. I was able to get my code to work with R 3.5 by using my custom loss I had before, but I had to create a dummy metric shown below.
This doesnt seem like it was intended? Should I move this issue to the official mxnet issue area or am I still messing something up?
mx.metric.rmse.mine <- mx.metric.custom("rmse.mine", function(label, pred)
{
res = pred
return(as.array(res))
})
Oh also, using this modification appears to require about 6GB more RAM. :-(
Custom metric need to return a single value.
In your case, you might want to do:
mx.metric.rmse.mine <- mx.metric.custom("rmse.mine", function(label, pred)
{
res = pred
return(mean(as.array(res)))
})
or
mx.metric.rmse.mine <- mx.metric.custom("rmse.mine", function(label, pred)
{
res = mx.nd.mean(pred)
return(as.array(res))
})
I am just saying the new default R 3.5 metric seemed to not run when using a MXNet custom loss. I was able to fix the issue by also creating a custom metric.
In otherwords, I had a custom loss, but used default metrics. MXNet would not run. I then used a custom metric and the code successfully ran. Maybe this doesnt happen for you? This observation did not happen with older versions of R.
mx.nd.internal.dispatch.Ops is acting differently for R version 3.5.
Mxnet R code that worked great with R 3.4.4 no longer works with 3.5 with random mx.nd.internal.dispatch.Ops errors.
Even the simple https://mxnet.incubator.apache.org/tutorials/r/fiveMinutesNeuralNetwork.html
results in the following error:
Something appears to be slightly different mx.nd.internal.dispatch.Ops
Difficult to debug in my complex CNN architecture.
R session info: