Skip to content
Closed
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
80 changes: 1 addition & 79 deletions src/optimum/rbln/configuration_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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"],
Expand Down
Loading