mirror of https://github.com/tracel-ai/burn.git
Don't panic when the progress is > 1.0 (#2229)
Ratatui asserts that gauges don't have a progress greater than 1.0 This can happen if a dataset reports a lower len() than it actually provides. This change prevents a panic when the `Progress::items_processed` is greater than the `Progress::items_total`
This commit is contained in:
parent
44030ead17
commit
23622d765d
|
@ -86,7 +86,7 @@ impl ProgressBarView {
|
||||||
|
|
||||||
let iteration = Gauge::default()
|
let iteration = Gauge::default()
|
||||||
.gauge_style(Style::default().fg(Color::Yellow))
|
.gauge_style(Style::default().fg(Color::Yellow))
|
||||||
.ratio(self.progress);
|
.ratio(self.progress.min(1.0));
|
||||||
let eta = Paragraph::new(Line::from(vec![
|
let eta = Paragraph::new(Line::from(vec![
|
||||||
Span::from(" ("),
|
Span::from(" ("),
|
||||||
Span::from(self.eta).italic(),
|
Span::from(self.eta).italic(),
|
||||||
|
|
Loading…
Reference in New Issue