Slackbot
10/20/2023, 3:05 PMMax (Nixtla)
10/20/2023, 5:17 PMFrancisco
10/20/2023, 7:28 PMFrancisco
10/20/2023, 7:30 PMFile "/Users/franciscotafur/anaconda3/envs/Merck2/lib/python3.10/site-packages/neuralforecast/models/nhits.py", line 43, in forward
forecast = F.interpolate(
File "/Users/franciscotafur/anaconda3/envs/Merck2/lib/python3.10/site-packages/torch/nn/functional.py", line 3954, in interpolate
return torch._C._nn.upsample_linear1d(input, output_size, align_corners, scale_factors)
NotImplementedError: The operator 'aten::upsample_linear1d.out' is not currently implemented for the MPS device. If you want this op to be added in priority during the prototype phase of this feature, please comment on <https://github.com/pytorch/pytorch/issues/77764>. As a temporary fix, you can set the environment variable `PYTORCH_ENABLE_MPS_FALLBACK=1` to use the CPU as a fallback for this op. WARNING: this will be slower than running natively on MPS.
[W 2023-10-20 14:23:25,600] Trial 0 failed with value None.
---------------------------------------------------------------------------
NotImplementedError Traceback (most recent call last)
Cell In[45], line 1
----> 1 nf.fit(df=df_final)
File ~/anaconda3/envs/Merck2/lib/python3.10/site-packages/neuralforecast/core.py:274, in NeuralForecast.fit(self, df, static_df, val_size, sort_df, use_init_models, verbose)
271 print("WARNING: Deleting previously fitted models.")
273 for model in self.models:
--> 274 model.fit(self.dataset, val_size=val_size)
276 self._fitted = True
File ~/anaconda3/envs/Merck2/lib/python3.10/site-packages/neuralforecast/common/_base_auto.py:375, in BaseAuto.fit(self, dataset, val_size, test_size, random_seed)
373 best_config = results.get_best_result().config
374 else:
--> 375 results = self._optuna_tune_model(
376 cls_model=self.cls_model,
377 dataset=dataset,
378 val_size=val_size,
379 test_size=test_size,
380 verbose=self.verbose,
381 num_samples=self.num_samples,
382 search_alg=search_alg,
383 config=self.config,
384 )
385 best_config = results.best_trial.user_attrs["ALL_PARAMS"]
386 self.model = self._fit_model(
387 cls_model=self.cls_model,
388 config=best_config,
(...)
391 test_size=test_size,
392 )
File ~/anaconda3/envs/Merck2/lib/python3.10/site-packages/neuralforecast/common/_base_auto.py:327, in BaseAuto._optuna_tune_model(self, cls_model, dataset, val_size, test_size, verbose, num_samples, search_alg, config)
324 sampler = None
326 study = optuna.create_study(sampler=sampler, direction="minimize")
--> 327 study.optimize(
328 objective,
329 n_trials=num_samples,
330 show_progress_bar=verbose,
331 )
332 return study
File ~/anaconda3/envs/Merck2/lib/python3.10/site-packages/optuna/study/study.py:442, in Study.optimize(self, func, n_trials, timeout, n_jobs, catch, callbacks, gc_after_trial, show_progress_bar)
339 def optimize(
340 self,
341 func: ObjectiveFuncType,
(...)
348 show_progress_bar: bool = False,
349 ) -> None:
350 """Optimize an objective function.
351
352 Optimization is done by choosing a suitable set of hyperparameter values from a given
(...)
440 If nested invocation of this method occurs.
441 """
--> 442 _optimize(
443 study=self,
444 func=func,
445 n_trials=n_trials,
446 timeout=timeout,
447 n_jobs=n_jobs,
448 catch=tuple(catch) if isinstance(catch, Iterable) else (catch,),
449 callbacks=callbacks,
450 gc_after_trial=gc_after_trial,
451 show_progress_bar=show_progress_bar,
452 )
File ~/anaconda3/envs/Merck2/lib/python3.10/site-packages/optuna/study/_optimize.py:66, in _optimize(study, func, n_trials, timeout, n_jobs, catch, callbacks, gc_after_trial, show_progress_bar)
64 try:
65 if n_jobs == 1:
---> 66 _optimize_sequential(
67 study,
68 func,
69 n_trials,
70 timeout,
71 catch,
72 callbacks,
73 gc_after_trial,
74 reseed_sampler_rng=False,
75 time_start=None,
76 progress_bar=progress_bar,
77 )
78 else:
79 if n_jobs == -1:
File ~/anaconda3/envs/Merck2/lib/python3.10/site-packages/optuna/study/_optimize.py:163, in _optimize_sequential(study, func, n_trials, timeout, catch, callbacks, gc_after_trial, reseed_sampler_rng, time_start, progress_bar)
160 break
162 try:
--> 163 frozen_trial = _run_trial(study, func, catch)
164 finally:
165 # The following line mitigates memory problems that can be occurred in some
166 # environments (e.g., services that use computing containers such as GitHub Actions).
167 # Please refer to the following PR for further details:
168 # <https://github.com/optuna/optuna/pull/325>.
169 if gc_after_trial:
File ~/anaconda3/envs/Merck2/lib/python3.10/site-packages/optuna/study/_optimize.py:251, in _run_trial(study, func, catch)
244 assert False, "Should not reach."
246 if (
247 frozen_trial.state == TrialState.FAIL
248 and func_err is not None
249 and not isinstance(func_err, catch)
250 ):
--> 251 raise func_err
252 return frozen_trial
File ~/anaconda3/envs/Merck2/lib/python3.10/site-packages/optuna/study/_optimize.py:200, in _run_trial(study, func, catch)
198 with get_heartbeat_thread(trial._trial_id, study._storage):
199 try:
--> 200 value_or_values = func(trial)
201 except exceptions.TrialPruned as e:
202 # TODO(mamu): Handle multi-objective cases.
203 state = TrialState.PRUNED
File ~/anaconda3/envs/Merck2/lib/python3.10/site-packages/neuralforecast/common/_base_auto.py:311, in BaseAuto._optuna_tune_model.<locals>.objective(trial)
309 def objective(trial):
310 cfg = config(trial)
--> 311 fitted_model = self._fit_model(
312 cls_model=cls_model,
313 config=cfg,
314 dataset=dataset,
315 val_size=val_size,
316 test_size=test_size,
317 )
318 trial.set_user_attr("ALL_PARAMS", cfg)
319 return fitted_model.trainer.callback_metrics["valid_loss"].item()
File ~/anaconda3/envs/Merck2/lib/python3.10/site-packages/neuralforecast/common/_base_auto.py:336, in BaseAuto._fit_model(self, cls_model, config, dataset, val_size, test_size)
334 def _fit_model(self, cls_model, config, dataset, val_size, test_size):
335 model = cls_model(**config)
--> 336 model.fit(dataset, val_size=val_size, test_size=test_size)
337 return model
FTrainer._run_stage(self)
1032 if self.training:
1033 with isolate_rng():
-> 1034 self._run_sanity_check()
1035 with torc
387 self._build_step_args_from_hook_kwargs(hook_kwargs, hook_name)
567 insample_mask=insample_mask, # [Ws, L]
(...)
570 stat_exog=stat_exog,
571 ) # [Ws, 1]
573 # Model Predictions
--> 574 output_batch = self(windows_batch)
575 valid_loss_batch = self._compute_valid_loss(
576 outsample_y=original_outsample_y,
577 output=output_batch,
578 outsample_mask=outsample_mask,
579 temporal_cols=batch["temporal_cols"],
580 )
581 valid_losses.append(valid_loss_batch)
File ~/anaconda3/envs/Merck2/lib/python3.10/site-packages/torch/nn/modules/module.py:1501, in Module._call_impl(self, *args, **kwargs)
1496 # If we don't have any hooks, we want to skip the rest of the logic in
1497 # this function, and just call forward.
1498 if not (self._backward_hooks or self._backward_pre_hooks or self._forward_hooks or self._forward_pre_hooks
1499 or _global_backward_pre_hooks or _global_backward_hooks
1500 or _global_forward_hooks or _global_forward_pre_hooks):
-> 1501 return forward_call(*args, **kwargs)
1502 # Do not call functions when jit is used
1503 full_backward_hooks, non_full_backward_hooks = [], []
File ~/anaconda3/envs/Merck2/lib/python3.10/site-packages/neuralforecast/models/nhits.py:392, in NHITS.forward(self, windows_batch)
390 block_forecasts = [forecast.repeat(1, self.h, 1)]
391 for i, block in enumerate(self.blocks):
--> 392 backcast, block_forecast = block(
393 insample_y=residuals,
394 futr_exog=futr_exog,
395 hist_exog=hist_exog,
396 stat_exog=stat_exog,
397 )
398 residuals = (residuals - backcast) * insample_mask
399 forecast = forecast + block_forecast
File ~/anaconda3/envs/Merck2/lib/python3.10/site-packages/torch/nn/modules/module.py:1501, in Module._call_impl(self, *args, **kwargs)
1496 # If we don't have any hooks, we want to skip the rest of the logic in
1497 # this function, and just call forward.
1498 if not (self._backward_hooks or self._backward_pre_hooks or self._forward_hooks or self._forward_pre_hooks
1499 or _global_backward_pre_hooks or _global_backward_hooks
1500 or _global_forward_hooks or _global_forward_pre_hooks):
-> 1501 return forward_call(*args, **kwargs)
1502 # Do not call functions when jit is used
1503 full_backward_hooks, non_full_backward_hooks = [], []
File ~/anaconda3/envs/Merck2/lib/python3.10/site-packages/neuralforecast/models/nhits.py:179, in NHITSBlock.forward(self, insample_y, futr_exog, hist_exog, stat_exog)
177 # Compute local projection weights and projection
178 theta = self.layers(insample_y)
--> 179 backcast, forecast = self.basis(theta)
180 return backcast, forecast
File ~/anaconda3/envs/Merck2/lib/python3.10/site-packages/torch/nn/modules/module.py:1501, in Module._call_impl(self, *args, **kwargs)
1496 # If we don't have any hooks, we want to skip the rest of the logic in
1497 # this function, and just call forward.
1498 if not (self._backward_hooks or self._backward_pre_hooks or self._forward_hooks or self._forward_pre_hooks
1499 or _global_backward_pre_hooks or _global_backward_hooks
1500 or _global_forward_hooks or _global_forward_pre_hooks):
-> 1501 return forward_call(*args, **kwargs)
1502 # Do not call functions when jit is used
1503 full_backward_hooks, non_full_backward_hooks = [], []
File ~/anaconda3/envs/Merck2/lib/python3.10/site-packages/neuralforecast/models/nhits.py:43, in _IdentityBasis.forward(self, theta)
40 knots = knots.reshape(len(knots), self.out_features, -1)
41 if self.interpolation_mode in ["nearest", "linear"]:
42 # knots = knots[:,None,:]
---> 43 forecast = F.interpolate(
44 knots, size=self.forecast_size, mode=self.interpolation_mode
45 )
46 # forecast = forecast[:,0,:]
47 elif "cubic" in self.interpolation_mode:
File ~/anaconda3/envs/Merck2/lib/python3.10/site-packages/torch/nn/functional.py:3954, in interpolate(input, size, scale_factor, mode, align_corners, recompute_scale_factor, antialias)
3952 if input.dim() == 3 and mode == "linear":
3953 assert align_corners is not None
-> 3954 return torch._C._nn.upsample_linear1d(input, output_size, align_corners, scale_factors)
3955 if input.dim() == 4 and mode == "bilinear":
3956 assert align_corners is not None
NotImplementedError: The operator 'aten::upsample_linear1d.out' is not currently implemented for the MPS device. If you want this op to be added in priority during the prototype phase of this feature, please comment on <https://github.com/pytorch/pytorch/issues/77764>. As a temporary fix, you can set the environment variable `PYTORCH_ENABLE_MPS_FALLBACK=1` to use the CPU as a fallback for this op. WARNING: this will be slower than running natively on MPS.
Francisco
10/20/2023, 7:30 PMMax (Nixtla)
10/20/2023, 7:45 PMJosé Morales
10/20/2023, 7:47 PMFrancisco
10/20/2023, 7:49 PMFrancisco
10/20/2023, 7:49 PMJosé Morales
10/20/2023, 8:11 PMJosé Morales
10/20/2023, 8:11 PMFrancisco
10/20/2023, 8:15 PMFrancisco
10/20/2023, 8:15 PM