From aea203441019d5212425298b3147dbedc7ae2dbc Mon Sep 17 00:00:00 2001 From: rebel-jongho Date: Mon, 27 Jul 2026 13:40:51 +0900 Subject: [PATCH] refactor(config): remove RBLNConfig.load() past its 0.11.0 removal deadline `RBLNAutoConfig.load()` and `RBLNModelConfig.load()` were thin wrappers that forwarded their arguments to `from_pretrained()`, marked for removal in 0.11.0 via `@deprecate_method`. Every 0.11.x build now raises on call: the current release is v0.11.0.post1, and since #614 the cutoff compares PEP 440 base versions, so alpha and dev builds are past it too. The deprecation policy in `utils/deprecation.py` calls for dropping them at this point. The now-unused `deprecate_method` import is dropped as well; the helper itself stays in `utils/deprecation.py` alongside `deprecate_kwarg` and is still covered by tests/test_base.py. Callers were already migrated: auto_factory.py in 235075e4 and test_load_config_object in 48217ce0. Co-Authored-By: Claude Opus 5 (1M context) --- src/optimum/rbln/configuration_utils.py | 80 +------------------------ 1 file changed, 1 insertion(+), 79 deletions(-) diff --git a/src/optimum/rbln/configuration_utils.py b/src/optimum/rbln/configuration_utils.py index 6b448ca3d..6208b39d5 100644 --- a/src/optimum/rbln/configuration_utils.py +++ b/src/optimum/rbln/configuration_utils.py @@ -24,7 +24,7 @@ from packaging.version import Version from .__version__ import __version__ -from .utils.deprecation import deprecate_kwarg, deprecate_method, warn_deprecated_npu +from .utils.deprecation import deprecate_kwarg, warn_deprecated_npu from .utils.logging import get_logger from .utils.runtime_utils import ContextRblnConfig @@ -310,42 +310,6 @@ def from_pretrained( path, rbln_config=rbln_config, return_unused_kwargs=return_unused_kwargs, **kwargs ) - @classmethod - @deprecate_method(version="0.11.0", new_method="from_pretrained") - def load( - cls, - path: str, - rbln_config: Union[dict[str, Any], "RBLNModelConfig"] | None = None, - return_unused_kwargs: bool = False, - **kwargs: dict[str, Any] | None, - ) -> Union["RBLNModelConfig", tuple["RBLNModelConfig", dict[str, Any]]]: - """ - Load RBLNModelConfig from a path. - Class name is automatically inferred from the `rbln_config.json` file. - - Deprecated: - This method is deprecated and will be removed in version 0.11.0. - Use `from_pretrained` instead. - - Args: - path (str): Path to the RBLNModelConfig file or directory. - rbln_config (dict[str, Any] | None): Additional configuration to override. - return_unused_kwargs (bool): Whether to return unused kwargs. - kwargs: Additional keyword arguments to override configuration values. - - Returns: - RBLNModelConfig: The loaded RBLNModelConfig. - - Examples: - ```python - # Deprecated usage: - config = RBLNAutoConfig.load("/path/to/model") - # Recommended usage: - config = RBLNAutoConfig.from_pretrained("/path/to/model") - ``` - """ - return cls.from_pretrained(path, rbln_config=rbln_config, return_unused_kwargs=return_unused_kwargs, **kwargs) - class RBLNModelConfig(RBLNSerializableConfigProtocol): """Base configuration class for RBLN models that handles compilation settings, runtime options, and submodules. @@ -1003,48 +967,6 @@ def from_pretrained( else: return rbln_config - @classmethod - @deprecate_method(version="0.11.0", new_method="from_pretrained") - def load( - cls, - path: str, - rbln_config: Union[dict[str, Any], "RBLNModelConfig"] | None = None, - return_unused_kwargs: bool = False, - **kwargs: dict[str, Any] | None, - ) -> Union["RBLNModelConfig", tuple["RBLNModelConfig", dict[str, Any]]]: - """ - Load a RBLNModelConfig from a path. - - Deprecated: - This method is deprecated and will be removed in version 0.11.0. - Use `from_pretrained` instead. - - Args: - path (str): Path to the RBLNModelConfig file or directory containing the config file. - rbln_config (dict[str, Any] | None): Additional configuration to override. - return_unused_kwargs (bool): Whether to return unused kwargs. - kwargs: Additional keyword arguments to override configuration values. - Keys starting with 'rbln_' will have the prefix removed and be used - to update the configuration. - - Returns: - RBLNModelConfig: The loaded configuration instance. - - Note: - This method loads the configuration from the specified path and applies any - provided overrides. If the loaded configuration class doesn't match the expected - class, a warning will be logged. - - Examples: - ```python - # Deprecated usage: - config = RBLNResNetForImageClassificationConfig.load("/path/to/model") - # Recommended usage: - config = RBLNResNetForImageClassificationConfig.from_pretrained("/path/to/model") - ``` - """ - return cls.from_pretrained(path, rbln_config=rbln_config, return_unused_kwargs=return_unused_kwargs, **kwargs) - @classmethod def initialize_from_kwargs( cls: type["RBLNModelConfig"],