public static String formatTimeDifference(long diff){ StringBuilder b = new StringBuilder(); formatTimeDifference(diff, b); return b.toString(); }
/** * Load a factory model from a given path. This can be trained with * {@link ClauseSplitter#train(Stream, Optional, Optional, Featurizer)}. * * @return A function taking a dependency tree, and returning a clause searcher. */ static ClauseSplitter load(String serializedModel) throws IOException { try { long start = System.currentTimeMillis(); Pair<Classifier<ClauseClassifierLabel,String>, Featurizer> data = IOUtils.readObjectFromURLOrClasspathOrFileSystem(serializedModel); ClauseSplitter rtn = (tree, truth) -> new ClauseSplitterSearchProblem(tree, truth, Optional.of(data.first), Optional.of(data.second)); log.info("Loading clause splitter from " + serializedModel + " ... done [" + Redwood.formatTimeDifference(System.currentTimeMillis() - start) + "]"); return rtn; } catch (ClassNotFoundException e) { throw new IllegalStateException("Invalid model at path: " + serializedModel, e); } }
long currTime = System.currentTimeMillis(); long sentPerSec = linesProcessed / ( (currTime - startTime) / 1000 ); debugStream.println('[' + Redwood.formatTimeDifference(currTime - startTime) + "] Processed " + linesProcessed + " sentences {" + sentPerSec + " sentences / second}... "); debugStream.println('[' + Redwood.formatTimeDifference(System.currentTimeMillis() - startTime) + "] DONE"); } catch (Throwable t) { debugStream.println("FATAL EXCEPTION!");
Redwood.formatTimeDifference(timeOfEnd-childInfo.beginTime,b); b.append(']');
log.info("Loaded " + i + " entries from Wikidict [" + SystemUtils.getMemoryInUse() + "MB memory used; " + Redwood.formatTimeDifference(System.currentTimeMillis() - startTime) + " elapsed]"); i += 1; log.info("Done reading Wikidict (" + dictionary.size() + " links read; " + Redwood.formatTimeDifference(System.currentTimeMillis() - startTime) + " elapsed)"); } catch (Exception e) { throw new RuntimeException(e);
/** {@inheritDoc} */ @Override public void handle(HttpExchange httpExchange) throws IOException { // Return a simple text message that says pong. httpExchange.getResponseHeaders().set("Content-type", "text/plain"); String response; int status; if (this.serverReady.get()) { response = "ready\n"; status = HTTP_OK; } else { response = "server is not ready yet. uptime=" + Redwood.formatTimeDifference(System.currentTimeMillis() - this.startTime) + '\n'; status = HTTP_UNAVAILABLE; } httpExchange.sendResponseHeaders(status, response.getBytes().length); httpExchange.getResponseBody().write(response.getBytes()); httpExchange.close(); } } // end static class ReadyHandler
trainExamples.stream().parallel().forEach(example -> { if (i.incrementAndGet() % 1000 == 0) { log.info("[" + Redwood.formatTimeDifference(System.currentTimeMillis() - beginTime) + "] Featurized " + i.get() + " / " + trainExamples.size() + " examples");
public static String formatTimeDifference(long diff){ StringBuilder b = new StringBuilder(); formatTimeDifference(diff, b); return b.toString(); }
public static String formatTimeDifference(long diff){ StringBuilder b = new StringBuilder(); formatTimeDifference(diff, b); return b.toString(); }
public static String formatTimeDifference(long diff){ StringBuilder b = new StringBuilder(); formatTimeDifference(diff, b); return b.toString(); }
/** * Load a factory model from a given path. This can be trained with * {@link ClauseSplitter#train(Stream, Optional, Optional, Featurizer)}. * * @return A function taking a dependency tree, and returning a clause searcher. */ static ClauseSplitter load(String serializedModel) throws IOException { try { long start = System.currentTimeMillis(); Pair<Classifier<ClauseClassifierLabel,String>, Featurizer> data = IOUtils.readObjectFromURLOrClasspathOrFileSystem(serializedModel); ClauseSplitter rtn = (tree, truth) -> new ClauseSplitterSearchProblem(tree, truth, Optional.of(data.first), Optional.of(data.second)); log.info("Loading clause splitter from " + serializedModel + " ... done [" + Redwood.formatTimeDifference(System.currentTimeMillis() - start) + "]"); return rtn; } catch (ClassNotFoundException e) { throw new IllegalStateException("Invalid model at path: " + serializedModel, e); } }
Redwood.formatTimeDifference(timeOfEnd-childInfo.beginTime,b); b.append(']');
Redwood.formatTimeDifference(timeOfEnd-childInfo.beginTime,b); b.append(']');
Redwood.formatTimeDifference(timeOfEnd-childInfo.beginTime,b); b.append(']');
/** {@inheritDoc} */ @Override public void handle(HttpExchange httpExchange) throws IOException { // Return a simple text message that says pong. httpExchange.getResponseHeaders().set("Content-type", "text/plain"); String response; int status; if (this.serverReady.get()) { response = "ready\n"; status = HTTP_OK; } else { response = "server is not ready yet. uptime=" + Redwood.formatTimeDifference(System.currentTimeMillis() - this.startTime) + '\n'; status = HTTP_UNAVAILABLE; } httpExchange.sendResponseHeaders(status, response.getBytes().length); httpExchange.getResponseBody().write(response.getBytes()); httpExchange.close(); } } // end static class ReadyHandler
log.info("Loaded " + i + " entries from Wikidict [" + SystemUtils.getMemoryInUse() + "MB memory used; " + Redwood.formatTimeDifference(System.currentTimeMillis() - startTime) + " elapsed]"); i += 1; log.info("Done reading Wikidict (" + dictionary.size() + " links read; " + Redwood.formatTimeDifference(System.currentTimeMillis() - startTime) + " elapsed)"); } catch (Exception e) { throw new RuntimeException(e);
trainExamples.stream().parallel().forEach(example -> { if (i.incrementAndGet() % 1000 == 0) { log.info("[" + Redwood.formatTimeDifference(System.currentTimeMillis() - beginTime) + "] Featurized " + i.get() + " / " + trainExamples.size() + " examples");