Skip to content

Commit

Permalink
Show progress regard for the displayed iteration
Browse files Browse the repository at this point in the history
  • Loading branch information
DrA1ex committed Sep 24, 2023
1 parent d8af3ff commit f32f599
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/app/neural-network/utils/progress.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {FetchDataAsyncReader, FileAsyncReader, ObservableStreamLoader, ProgressFn} from "./fetch";
import * as CommonUtils from "./common";
import {ProgressUtils} from "../neural-network";

export enum Color {
red = "\u001B[31m",
Expand Down Expand Up @@ -123,7 +122,6 @@ export function progressCallback(options: Partial<ProgressOptions> = {}): Progre

const elapsedTime = (performance.now() - startTime) / 1000;
const isFirstIter = iteration === 0;
const progress = iteration / total;

const speed = !isFirstIter ? elapsedTime / iteration : 0
const estimateTime = !isFirstIter ? speed * total : 0
Expand All @@ -143,6 +141,7 @@ export function progressCallback(options: Partial<ProgressOptions> = {}): Progre
speedStr = speed !== 0 ? `${Converters.TimeSpan(speed * 1000)}/it` : "n/a";
}

const progress = displayIterationValue / total;
const output = opts.color + opts.background
+ `${Math.floor(progress * 100).toString().padStart(3, " ")}%|`
+ progressBar(progress, opts.width)
Expand Down

0 comments on commit f32f599

Please sign in to comment.