so after i run this
run_name = f'Prob_forecast datasetstep={step_in_dataset} lag={lag_freq} in={context_length} out={prediction_length}'
model_rev = 'deepAR_model_rev_1_0'
model_path = f'{work_model_path}/{model_rev}'
if TRAINING:
mlflow.pytorch.autolog()
with mlflow.start_run(experiment_id=experiment_id, run_name=run_name):
# Fit the model
trainer.fit(model, train_dataloaders=train_dataset)
mlflow.end_run()
estimator
and get an error
TypeError Traceback (most recent call last)
Cell In[42], line 12
8 mlflow.pytorch.autolog()
10 with mlflow.start_run(experiment_id=experiment_id, run_name=run_name):
11 # Fit the model
---> 12 trainer.fit(model, train_dataloaders=train_dataset)
15 mlflow.end_run()
17 estimator
File ~\miniconda3\envs\pronin\lib\site-packages\mlflow\utils\autologging_utils\safety.py:576, in safe_patch..safe_patch_function(*args, **kwargs)
574 patch_function.call(call_original, *args, **kwargs)
575 else:
--> 576 patch_function(call_original, *args, **kwargs)
578 session.state = "succeeded"
580 try_log_autologging_event(
581 AutologgingEventLogger.get_logger().log_patch_function_success,
582 session,
(...)
586 kwargs,
587 )
File ~\miniconda3\envs\pronin\lib\site-packages\mlflow\utils\autologging_utils\safety.py:249, in with_managed_run..patch_with_managed_run(original, *args, **kwargs)
246 managed_run = create_managed_run()
248 try:
--> 249 result = patch_function(original, *args, **kwargs)
250 except (Exception, KeyboardInterrupt):
251 # In addition to standard Python exceptions, handle keyboard interrupts to ensure
252 # that runs are terminated if a user prematurely interrupts training execution
253 # (e.g. via sigint / ctrl-c)
254 if managed_run:
File ~\miniconda3\envs\pronin\lib\site-packages\mlflow\pytorch_lightning_autolog.py:537, in patched_fit(original, self, *args, **kwargs)
530 warnings.warn(
531 "Automatic model checkpointing is disabled because this feature only "
532 "supports pytorch-lightning >= 1.6.0."
533 )
535 client.flush(synchronous=False)
--> 537 result = original(self, *args, **kwargs)
539 if early_stop_callback is not None:
540 _log_early_stop_metrics(early_stop_callback, client, run_id)
File ~\miniconda3\envs\pronin\lib\site-packages\mlflow\utils\autologging_utils\safety.py:557, in safe_patch..safe_patch_function..call_original(*og_args, *og_kwargs)
554 original_result = original(_og_args, **_og_kwargs)
555 return original_result
--> 557 return call_original_fn_with_event_logging(_original_fn, og_args, og_kwargs)
File ~\miniconda3\envs\pronin\lib\site-packages\mlflow\utils\autologging_utils\safety.py:492, in safe_patch..safe_patch_function..call_original_fn_with_event_logging(original_fn, og_args, og_kwargs)
483 try:
484 try_log_autologging_event(
485 AutologgingEventLogger.get_logger().log_original_function_start,
486 session,
(...)
490 og_kwargs,
491 )
--> 492 original_fn_result = original_fn(*og_args, **og_kwargs)
494 try_log_autologging_event(
495 AutologgingEventLogger.get_logger().log_original_function_success,
496 session,
(...)
500 og_kwargs,
501 )
502 return original_fn_result
File ~\miniconda3\envs\pronin\lib\site-packages\mlflow\utils\autologging_utils\safety.py:554, in safe_patch..safe_patch_function..call_original.._original_fn(_og_args, **_og_kwargs)
546 # Show all non-MLflow warnings as normal (i.e. not as event logs)
547 # during original function execution, even if silent mode is enabled
548 # (silent=True), since these warnings originate from the ML framework
549 # or one of its dependencies and are likely relevant to the caller
550 with set_non_mlflow_warnings_behavior_for_current_thread(
551 disable_warnings=False,
552 reroute_warnings=False,
553 ):
--> 554 original_result = original(_og_args, **_og_kwargs)
555 return original_result
File ~\miniconda3\envs\pronin\lib\site-packages\pytorch_lightning\trainer\trainer.py:538, in Trainer.fit(self, model, train_dataloaders, val_dataloaders, datamodule, ckpt_path)
504 def fit(
505 self,
506 model: "pl.LightningModule",
(...)
510 ckpt_path: Optional[_PATH] = None,
511 ) -> None:
512 r"""Runs the full optimization routine.
513
514 Args:
(...)
536
537 """
--> 538 model = _maybe_unwrap_optimized(model)
539 self.strategy._lightning_module = model
540 _verify_strategy_supports_compile(model, self.strategy)
File ~\miniconda3\envs\pronin\lib\site-packages\pytorch_lightning\utilities\compile.py:132, in _maybe_unwrap_optimized(model)
130 return model
131 _check_mixed_imports(model)
--> 132 raise TypeError(
133 f"model must be a LightningModule or torch._dynamo.OptimizedModule, got {type(model).qualname}"
134 )
TypeError: model must be a LightningModule or torch._dynamo.OptimizedModule, got DeepARLightningModule