use of org.deeplearning4j.ui.flow.data.FlowUpdatePersistable in project deeplearning4j by deeplearning4j.
the class FlowIterationListener method iterationDone.
/**
* Event listener for each iteration
*
* @param model the model iterating
* @param iteration the iteration
*/
@Override
public synchronized void iterationDone(Model model, int iteration) {
if (iterationCount.incrementAndGet() % frequency == 0) {
currTime = System.currentTimeMillis();
if (firstIteration) {
// On first pass we just build list of layers. However, for MultiLayerNetwork first pass is the last pass, since we know connections in advance
ModelInfo info = buildModelInfo(model);
// send ModelInfo to stats storage
Persistable staticInfo = new FlowStaticPersistable(sessionID, workerID, System.currentTimeMillis(), info);
ssr.putStaticInfo(staticInfo);
}
// update modelState
buildModelState(model);
Persistable updateInfo = new FlowUpdatePersistable(sessionID, workerID, System.currentTimeMillis(), modelState);
ssr.putUpdate(updateInfo);
if (firstIteration && openBrowser) {
UIServer uiServer = UIServer.getInstance();
String path = "http://localhost:" + uiServer.getPort() + "/flow?sid=" + sessionID;
try {
UiUtils.tryOpenBrowser(path, log);
} catch (Exception e) {
}
firstIteration = false;
}
}
lastTime = System.currentTimeMillis();
}
use of org.deeplearning4j.ui.flow.data.FlowUpdatePersistable in project deeplearning4j by deeplearning4j.
the class FlowListenerModule method getUpdate.
private Result getUpdate(String sessionID) {
if (!knownSessionIDs.containsKey(sessionID))
return ok("Unknown session ID");
StatsStorage ss = knownSessionIDs.get(sessionID);
List<Persistable> list = ss.getLatestUpdateAllWorkers(sessionID, TYPE_ID);
if (list == null || list.size() == 0)
return ok();
Persistable p = list.get(0);
if (!(p instanceof FlowUpdatePersistable))
return ok();
FlowUpdatePersistable f = (FlowUpdatePersistable) p;
return ok(Json.toJson(f.getModelState()));
}
Aggregations