Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added ignore for hyper params #20213

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/lightning/pytorch/utilities/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import inspect
import pickle
import types
from argparse import Namespace
from collections.abc import MutableMapping, Sequence
from dataclasses import fields, is_dataclass
from typing import Any, Literal, Optional, Union
Expand Down Expand Up @@ -202,6 +203,11 @@ def save_hyperparameters(
obj._hparams_name = "kwargs"

# `hparams` are expected here

# filter out hp based on ignore list
if isinstance(hp, Namespace):
hp = vars(hp)
hp = {k: v for k, v in hp.items() if k not in ignore}
obj._set_hparams(hp)

for k, v in obj._hparams.items():
Expand Down
Loading