Skip to content

Commit

Permalink
suppress warning when saving hyperparameters in base auto (#1034)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmoralez authored Jul 1, 2024
1 parent ae25a83 commit 29b8e72
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion nbs/common.base_auto.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"outputs": [],
"source": [
"#| export\n",
"import warnings\n",
"from copy import deepcopy\n",
"from os import cpu_count\n",
"\n",
Expand Down Expand Up @@ -169,7 +170,11 @@
" callbacks=None,\n",
" ):\n",
" super(BaseAuto, self).__init__()\n",
" self.save_hyperparameters() # Allows instantiation from a checkpoint from class\n",
" with warnings.catch_warnings(record=False):\n",
" warnings.filterwarnings('ignore')\n",
" # the following line issues a warning about the loss attribute being saved\n",
" # but we do want to save it\n",
" self.save_hyperparameters() # Allows instantiation from a checkpoint from class\n",
"\n",
" if backend == 'ray':\n",
" if not isinstance(config, dict):\n",
Expand Down
7 changes: 6 additions & 1 deletion neuralforecast/common/_base_auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
__all__ = ['BaseAuto']

# %% ../../nbs/common.base_auto.ipynb 5
import warnings
from copy import deepcopy
from os import cpu_count

Expand Down Expand Up @@ -101,7 +102,11 @@ def __init__(
callbacks=None,
):
super(BaseAuto, self).__init__()
self.save_hyperparameters() # Allows instantiation from a checkpoint from class
with warnings.catch_warnings(record=False):
warnings.filterwarnings("ignore")
# the following line issues a warning about the loss attribute being saved
# but we do want to save it
self.save_hyperparameters() # Allows instantiation from a checkpoint from class

if backend == "ray":
if not isinstance(config, dict):
Expand Down

0 comments on commit 29b8e72

Please sign in to comment.