6
$\begingroup$

I'm more or less trying the code from the documentation:

dir = CreateDirectory[];    
net = LinearLayer[];    
NetTrain[net, {1 -> 1.9, 2 -> 4.1, 3 -> 6.0, 4 -> 8.1}, 
  MaxTrainingRounds -> Quantity[10, "Seconds"], 
  TrainingProgressCheckpointing -> {"Directory", dir, 
    "Interval" -> Quantity[3, "Seconds"]}]

FileNames["*", dir]

I would expect 3 checkpoint files in the directory. Instead, I see error messages like this:

LinkObject::linkn: Argument LinkObject["F:\Program Files\Wolfram Research\Mathematica\11.1\SystemFiles\Converters\Binaries\Windows-x86-64\HDF5.exe",1181,5] in LinkWrite[LinkObject["F:\Program Files\Wolfram Research\Mathematica\11.1\SystemFiles\Converters\Binaries\Windows-x86-64\HDF5.exe",1181,5],CallPacket[4,{C:\Temp\m-2d8a2c7d-0e19-430d-9f42-165189f9d731\2017-04-05T18:14:08_4_00001_00001_none.wlnet,/Version,1,1,9,{49,49,46,49,46,49,0}}]] has an invalid LinkObject number; the link may be closed.

I'm using Mathematica 11.1 on Windows 10.

$\endgroup$
  • $\begingroup$ It works for me on mac os. $\endgroup$ – xslittlegrass Apr 5 '17 at 16:56
  • $\begingroup$ Try quitting the kernel first $\endgroup$ – M.R. Apr 5 '17 at 18:30
6
$\begingroup$

The "Directory" checkpointing method is broken on Windows. A fix is shipping in 11.1.1 (if not earlier in a paclet update). The cause of this problem is that the produced filenames contain the ISO date and time of the start of training, but the : character is forbidden in file paths on Windows except as the drive designator e.g. "C:/".

Until the fix reaches you, you can work around the issue by tricking NetTrain into using just the date for the base file path:

Block[{DateString = Compose[Function, DateString["ISODate"]]},
    NetTrain[...]
]
| improve this answer | |
$\endgroup$
2
$\begingroup$

In windows, the TrainingProgressCheckpointing code isn't currently working. If you do attempt to use it, you won't be able to export wlnets for the current kernel session as well.

Edit : the workaround posted above works very well! Thank you!

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.