|
14 | 14 | """The LightningModule - an nn.Module with many additional features.""" |
15 | 15 |
|
16 | 16 | import collections.abc |
17 | | -import inspect |
18 | 17 | import logging |
19 | 18 | import numbers |
20 | 19 | import os |
|
46 | 45 | from pytorch_lightning.utilities.distributed import distributed_available, sync_ddp |
47 | 46 | from pytorch_lightning.utilities.exceptions import MisconfigurationException |
48 | 47 | from pytorch_lightning.utilities.imports import _TORCH_GREATER_EQUAL_1_11, _TORCH_GREATER_EQUAL_1_13 |
49 | | -from pytorch_lightning.utilities.parsing import collect_init_args |
50 | 48 | from pytorch_lightning.utilities.rank_zero import rank_zero_debug, rank_zero_deprecation, rank_zero_warn |
51 | 49 | from pytorch_lightning.utilities.signature_utils import is_param_in_hook_signature |
52 | 50 | from pytorch_lightning.utilities.types import _METRIC_COLLECTION, EPOCH_OUTPUT, LRSchedulerTypeUnion, STEP_OUTPUT |
@@ -1782,34 +1780,6 @@ def _verify_is_manual_optimization(self, fn_name): |
1782 | 1780 | " set model property `automatic_optimization` as False" |
1783 | 1781 | ) |
1784 | 1782 |
|
1785 | | - @classmethod |
1786 | | - def _auto_collect_arguments(cls, frame=None) -> Tuple[Dict, Dict]: |
1787 | | - """Collect all module arguments in the current constructor and all child constructors. The child |
1788 | | - constructors are all the ``__init__`` methods that reach the current class through (chained) |
1789 | | - ``super().__init__()`` calls. |
1790 | | -
|
1791 | | - Args: |
1792 | | - frame: instance frame |
1793 | | -
|
1794 | | - Returns: |
1795 | | - self_arguments: arguments dictionary of the first instance |
1796 | | - parents_arguments: arguments dictionary of the parent's instances |
1797 | | - """ |
1798 | | - if not frame: |
1799 | | - frame = inspect.currentframe() |
1800 | | - |
1801 | | - frame_args = collect_init_args(frame.f_back, []) |
1802 | | - self_arguments = frame_args[-1] |
1803 | | - |
1804 | | - # set hyper_parameters in child |
1805 | | - self_arguments = self_arguments |
1806 | | - parents_arguments = {} |
1807 | | - |
1808 | | - # add all arguments from parents |
1809 | | - for args in frame_args[:-1]: |
1810 | | - parents_arguments.update(args) |
1811 | | - return self_arguments, parents_arguments |
1812 | | - |
1813 | 1783 | @torch.no_grad() |
1814 | 1784 | def to_onnx(self, file_path: Union[str, Path], input_sample: Optional[Any] = None, **kwargs): |
1815 | 1785 | """Saves the model in ONNX format. |
|
0 commit comments