Skip to content

Commit

Permalink
Apply a more defensive way to fix redownloading issue (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
james77777778 authored Oct 20, 2024
1 parent cf61558 commit bb23161
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion kimm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
from kimm._src.utils.model_registry import list_models
from kimm._src.version import version

__version__ = "0.2.4"
__version__ = "0.2.5"
8 changes: 8 additions & 0 deletions kimm/_src/models/base_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,14 @@ def get_config(self):
def fix_config(self, config: typing.Dict):
return config

@classmethod
def from_config(cls, config, custom_objects=None):
# Set `self._weight` to `None` to avoid redownloading issue.
config = config.copy()
if "weights" in config:
config["weights"] = None
return cls(**config)

def __repr__(self):
repr_str = (
f"<{self.__class__.__name__} "
Expand Down
2 changes: 1 addition & 1 deletion kimm/_src/version.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from kimm._src.kimm_export import kimm_export

__version__ = "0.2.4"
__version__ = "0.2.5"


@kimm_export("kimm")
Expand Down

0 comments on commit bb23161

Please sign in to comment.