Why do I get the error "The value of 'CheckpointPath' is invalid. Checkpoint path must be an existing directory with write permission or empty."?

81 ビュー (過去 30 日間)
Duc-Toan Tra
Duc-Toan Tra 2024 年 11 月 8 日 13:03
回答済み: Manish 2024 年 11 月 27 日 5:03
Hi everyone!
I got some issue when I run this code:
checkpointPath = pwd;
options = trainingOptions('adam', ...
'InitialLearnRate',0.1, ...
'MaxEpochs',20, ...
'Verbose',false, ...
'Plots','training-progress', ...
'Shuffle','every-epoch', ...
'CheckpointPath',checkpointPath);
Matlab says that some error occurs:
Error using nnet.cnn.TrainingOptionsADAM
The value of 'CheckpointPath' is invalid. Checkpoint path must be an existing directory with write permission or empty.
Error in trainingOptions (line 342)
opts = nnet.cnn.TrainingOptionsADAM(varargin{:});
I can save .mat file at this path, but I get this error when I use the function trainingOptions with it. I can run this code on C drive without error but cannot do that on the other drives. Thanks everyone.
  2 件のコメント
Stephen23
Stephen23 2024 年 11 月 9 日 9:26
What OS? What value does PWD() return?
Is there anything special about that folder (e.g. cloud drive, installation folder, etc).
Duc-Toan Tra
Duc-Toan Tra 2024 年 11 月 9 日 13:42
Thanks for replying, bro.
1/ I am using matlab 2022b on win10 and installed matlab on drive "I".
2/ This folder is synchronized with google cloud.
3/ I can run this code on any other drive except the folders on drive "I" (including folders not synchronized with cloud).
4/ The return value of pwd is as follows 'I:\Desktop\work data\Programming\Matlab\Neural network\Neural network for classification'

サインインしてコメントする。

回答 (1 件)

Manish
Manish 2024 年 11 月 27 日 5:03
Hi,
I understand that you'd like to save the checkpoints in the current working directory. However, the issue you're encountering might be due to write permissions on your C drive.
As a workaround, you can create an empty folder in the current working directory. Once the folder is created, use its path as the value for the CheckpointPath.
Here is the sample code:
path = "C:\Users\Demo"; % Demo is the new empty folder
options = trainingOptions("sgdm", ...
MaxEpochs=15, ...
InitialLearnRate=0.01, ...
Plots="training-progress", ...
Metrics="accuracy", ...
CheckpointPath=path,...
Verbose=0);
Hope this helps!

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by