public class CheckpointListener extends BaseListener implements Serializable
| Modifier and Type | Class and Description |
|---|---|
static class |
CheckpointListener.Builder |
| Modifier and Type | Method and Description |
|---|---|
List<Checkpoint> |
availableCheckpoints()
List all available checkpoints.
|
static List<Checkpoint> |
availableCheckpoints(File directory)
List all available checkpoints.
|
static CheckpointListener.Builder |
builder(@NonNull File rootDir) |
ListenerResponse |
epochEnd(SameDiff sameDiff,
At at,
LossCurve lossCurve,
long epochTimeMillis)
Called at the end of every epoch, when fitting from an iterator
|
File |
getFileForCheckpoint(Checkpoint checkpoint)
Get the model file for the given checkpoint.
|
static File |
getFileForCheckpoint(File rootDir,
int checkpointNum) |
File |
getFileForCheckpoint(int checkpointNum)
Get the model file for the given checkpoint number.
|
boolean |
isActive(Operation operation)
Returns whether this listener is active during the given operation.
|
void |
iterationDone(SameDiff sd,
At at,
MultiDataSet dataSet,
Loss loss)
Called at the end of every iteration, after all operations (including updating parameters) has been completed
|
Checkpoint |
lastCheckpoint()
Return the most recent checkpoint, if one exists - otherwise returns null
|
static Checkpoint |
lastCheckpoint(File rootDir)
Return the most recent checkpoint, if one exists - otherwise returns null
|
static SameDiff |
loadCheckpoint(File rootDir,
int checkpointNum,
boolean loadUpdaterState)
Load a SameDiff instance for the given checkpoint that resides in the specified root directory
|
SameDiff |
loadCheckpoint(int checkpointNum,
boolean loadUpdaterState)
Load a given checkpoint number
|
static SameDiff |
loadLastCheckpoint(File rootDir,
boolean loadUpdaterState)
Load the last (most recent) checkpoint from the specified root directory
|
activationAvailable, epochStart, iterationStart, operationEnd, operationStart, opExecution, preOpExecution, preUpdate, requiredVariables, validationDonepublic ListenerResponse epochEnd(SameDiff sameDiff, At at, LossCurve lossCurve, long epochTimeMillis)
ListenerepochEnd in interface ListenerepochEnd in class BaseListenersameDiff - The SameDiff instanceat - Current iteration/epoch etclossCurve - The losses so farepochTimeMillis - How long this epoch tookpublic boolean isActive(Operation operation)
Listenerpublic void iterationDone(SameDiff sd, At at, MultiDataSet dataSet, Loss loss)
ListeneriterationDone in interface ListeneriterationDone in class BaseListenersd - The SameDiff instanceat - Current iteration/epoch etcdataSet - The current dataset (minibatch) used for trainingloss - The loss value for the current minibatch. Will be null except for during trainingpublic List<Checkpoint> availableCheckpoints()
public static List<Checkpoint> availableCheckpoints(File directory)
public Checkpoint lastCheckpoint()
public static Checkpoint lastCheckpoint(File rootDir)
rootDir - Root direcotry for the checkpoint filespublic File getFileForCheckpoint(Checkpoint checkpoint)
checkpoint - Checkpoint to get the model file forpublic File getFileForCheckpoint(int checkpointNum)
checkpointNum - Checkpoint number to get the model file forpublic SameDiff loadCheckpoint(int checkpointNum, boolean loadUpdaterState)
loadUpdaterState - If true: load the updater state. See SameDiff.load(File, boolean) for more detailspublic static SameDiff loadCheckpoint(File rootDir, int checkpointNum, boolean loadUpdaterState)
rootDir - Directory that the checkpoint resides incheckpointNum - Checkpoint model number to loadloadUpdaterState - If true: load the updater state. See SameDiff.load(File, boolean) for more detailspublic static SameDiff loadLastCheckpoint(File rootDir, boolean loadUpdaterState)
rootDir - Root directory to load checpoint frompublic static CheckpointListener.Builder builder(@NonNull @NonNull File rootDir)
Copyright © 2021. All rights reserved.