Search in sources :

Example 1 with FlowUpdatePersistable

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();
}
Also used : FlowStaticPersistable(org.deeplearning4j.ui.flow.data.FlowStaticPersistable) FlowUpdatePersistable(org.deeplearning4j.ui.flow.data.FlowUpdatePersistable) Persistable(org.deeplearning4j.api.storage.Persistable) FlowStaticPersistable(org.deeplearning4j.ui.flow.data.FlowStaticPersistable) FlowUpdatePersistable(org.deeplearning4j.ui.flow.data.FlowUpdatePersistable) UIServer(org.deeplearning4j.ui.api.UIServer)

Example 2 with FlowUpdatePersistable

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()));
}
Also used : StatsStorage(org.deeplearning4j.api.storage.StatsStorage) FlowUpdatePersistable(org.deeplearning4j.ui.flow.data.FlowUpdatePersistable) FlowStaticPersistable(org.deeplearning4j.ui.flow.data.FlowStaticPersistable) Persistable(org.deeplearning4j.api.storage.Persistable) FlowUpdatePersistable(org.deeplearning4j.ui.flow.data.FlowUpdatePersistable)

Aggregations

Persistable (org.deeplearning4j.api.storage.Persistable)2 FlowStaticPersistable (org.deeplearning4j.ui.flow.data.FlowStaticPersistable)2 FlowUpdatePersistable (org.deeplearning4j.ui.flow.data.FlowUpdatePersistable)2 StatsStorage (org.deeplearning4j.api.storage.StatsStorage)1 UIServer (org.deeplearning4j.ui.api.UIServer)1