unit8co / darts

A python library for user-friendly forecasting and anomaly detection on time series.
https://unit8co.github.io/darts/
Apache License 2.0
8.05k stars 878 forks source link

[BUG] Unable to fit rnn on data #337

Closed rishikeshkushwaha closed 3 years ago

rishikeshkushwaha commented 3 years ago

ValueError Traceback (most recent call last)

in ----> 1 my_model.fit(scaled_train_data, verbose=True) # 107 ~/environment/lib/python3.8/site-packages/darts/utils/torch.py in decorator(self, *args, **kwargs) 63 with fork_rng(): 64 manual_seed(self._random_instance.randint(0, high=MAX_TORCH_SEED_VALUE)) ---> 65 decorated(self, *args, **kwargs) 66 return decorator ~/environment/lib/python3.8/site-packages/darts/models/torch_forecasting_model.py in fit(self, series, covariates, val_series, val_covariates, verbose) 293 logger.info('Train dataset contains {} samples.'.format(len(train_dataset))) 294 --> 295 self.fit_from_dataset(train_dataset, val_dataset, verbose) 296 297 @random_method ~/environment/lib/python3.8/site-packages/darts/utils/torch.py in decorator(self, *args, **kwargs) 63 with fork_rng(): 64 manual_seed(self._random_instance.randint(0, high=MAX_TORCH_SEED_VALUE)) ---> 65 decorated(self, *args, **kwargs) 66 return decorator ~/environment/lib/python3.8/site-packages/darts/models/torch_forecasting_model.py in fit_from_dataset(self, train_dataset, val_dataset, verbose) 346 347 # Train model --> 348 self._train(train_loader, val_loader, tb_writer, verbose) 349 350 # Close tensorboard writer ~/environment/lib/python3.8/site-packages/darts/models/torch_forecasting_model.py in _train(self, train_loader, val_loader, tb_writer, verbose) 579 if tb_writer is not None: 580 for name, param in self.model.named_parameters(): --> 581 tb_writer.add_histogram(name + '/gradients', param.grad.data.cpu().numpy(), epoch) 582 tb_writer.add_scalar("training/loss", total_loss / (batch_idx + 1), epoch) 583 tb_writer.add_scalar("training/loss_total", total_loss / (batch_idx + 1), epoch) ~/environment/lib/python3.8/site-packages/torch/utils/tensorboard/writer.py in add_histogram(self, tag, values, global_step, bins, walltime, max_bins) 427 bins = self.default_bins 428 self._get_file_writer().add_summary( --> 429 histogram(tag, values, bins, max_bins=max_bins), global_step, walltime) 430 431 def add_histogram_raw(self, tag, min, max, num, sum, sum_squares, ~/environment/lib/python3.8/site-packages/torch/utils/tensorboard/summary.py in histogram(name, values, bins, max_bins) 298 """ 299 values = make_np(values) --> 300 hist = make_histogram(values.astype(float), bins, max_bins) 301 return Summary(value=[Summary.Value(tag=name, histo=hist)]) 302 ~/environment/lib/python3.8/site-packages/torch/utils/tensorboard/summary.py in make_histogram(values, bins, max_bins) 336 337 if counts.size == 0 or limits.size == 0: --> 338 raise ValueError('The histogram is empty, please file a bug report.') 339 340 sum_sq = values.dot(values) ValueError: The histogram is empty, please file a bug report.
hrzn commented 3 years ago

Could you please share the data and the code you are using, so that we can try and reproduce the issue? Thanks.