Skip to content

Commit ddec1fb

Browse files
committed
fix: removed forbidden properties from asset extension
1 parent 420f876 commit ddec1fb

File tree

1 file changed

+20
-35
lines changed

1 file changed

+20
-35
lines changed

pystac/extensions/mlm.py

Lines changed: 20 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1616,8 +1616,6 @@ def apply(
16161616
accelerator_summary: str | None = None,
16171617
accelerator_count: int | None = None,
16181618
hyperparameters: Hyperparameters | None = None,
1619-
*args: Any,
1620-
**kwargs: Any,
16211619
) -> None:
16221620
"""
16231621
Sets the properties of a new MLMExtension
@@ -1647,10 +1645,6 @@ def apply(
16471645
accelerator_count: A minimum amount of ``accelerator`` instances required to
16481646
run the model
16491647
hyperparameters: Additional hyperparameters relevant for the model
1650-
*args: Unused (no effect, only here for signature compliance with apply
1651-
method in derived classes
1652-
**kwargs: Unused (no effect, only here for signature compliance with apply
1653-
method in derived classes
16541648
"""
16551649
self.mlm_name = name
16561650
self.architecture = architecture
@@ -1922,7 +1916,11 @@ def __repr__(self) -> str:
19221916
return f"<AssetGeneralMLMExtension Asset href={self.asset_href}>"
19231917

19241918

1925-
class AssetDetailedMLMExtension(_AssetMLMExtension, MLMExtension[pystac.Asset]):
1919+
class AssetDetailedMLMExtension(
1920+
_AssetMLMExtension,
1921+
_IncludedInAssetProps,
1922+
ExtensionManagementMixin[pystac.Item | pystac.Collection],
1923+
):
19261924
"""A class that can be used to extend the properties of an
19271925
:class:`pystac.Asset` object with properties from the
19281926
:stac-ext:`Machine Learning Model Extension <mlm>`.
@@ -1960,11 +1958,8 @@ def ext(
19601958

19611959
def apply(
19621960
self,
1963-
name: str,
19641961
architecture: str,
19651962
tasks: list[TaskType],
1966-
input: list[ModelInput],
1967-
output: list[ModelOutput],
19681963
framework: str | None = None,
19691964
framework_version: str | None = None,
19701965
memory_size: int | None = None,
@@ -1976,7 +1971,6 @@ def apply(
19761971
accelerator_constrained: bool | None = None,
19771972
accelerator_summary: str | None = None,
19781973
accelerator_count: int | None = None,
1979-
hyperparameters: Hyperparameters | None = None,
19801974
artifact_type: str | None = None,
19811975
compile_method: str | None = None,
19821976
entrypoint: str | None = None,
@@ -1985,12 +1979,9 @@ def apply(
19851979
Sets the properties of a new AssetDetailedMLMExtensions
19861980
19871981
Args:
1988-
name: name for the model
19891982
architecture: A generic and well established architecture name of the model
19901983
tasks: Specifies the Machine Learning tasks for which the model can be
19911984
used for
1992-
input: Describes the transformation between the EO data and the model input
1993-
output: Describes each model output and how to interpret it.
19941985
framework: Framework used to train the model
19951986
framework_version: The ``framework`` library version
19961987
memory_size: The in-memory size of the model on the accelerator during
@@ -2008,7 +1999,6 @@ def apply(
20081999
accelerator_summary: A high level description of the ``accelerator``
20092000
accelerator_count: A minimum amount of ``accelerator`` instances required to
20102001
run the model
2011-
hyperparameters: Additional hyperparameters relevant for the model
20122002
artifact_type: Specifies the kind of model artifact, any string is allowed.
20132003
Typically related to a particular ML framework. This property is
20142004
required when ``mlm:model`` is listed as a role of this asset
@@ -2017,26 +2007,21 @@ def apply(
20172007
entrypoint: Specific entrypoint reference in the code to use for running
20182008
model inference.
20192009
"""
2020-
MLMExtension.apply(
2021-
self,
2022-
name=name,
2023-
architecture=architecture,
2024-
tasks=tasks,
2025-
input=input,
2026-
output=output,
2027-
framework=framework,
2028-
framework_version=framework_version,
2029-
memory_size=memory_size,
2030-
total_parameters=total_parameters,
2031-
pretrained=pretrained,
2032-
pretrained_source=pretrained_source,
2033-
batch_size_suggestion=batch_size_suggestion,
2034-
accelerator=accelerator,
2035-
accelerator_constrained=accelerator_constrained,
2036-
accelerator_summary=accelerator_summary,
2037-
accelerator_count=accelerator_count,
2038-
hyperparameters=hyperparameters,
2039-
)
2010+
2011+
self.architecture = architecture
2012+
self.tasks = tasks
2013+
self.framework = framework
2014+
self.framework_version = framework_version
2015+
self.memory_size = memory_size
2016+
self.total_parameters = total_parameters
2017+
self.pretrained = pretrained
2018+
self.pretrained_source = pretrained_source
2019+
self.batch_size_suggestion = batch_size_suggestion
2020+
self.accelerator = accelerator
2021+
self.accelerator_constrained = accelerator_constrained
2022+
self.accelerator_summary = accelerator_summary
2023+
self.accelerator_count = accelerator_count
2024+
20402025
self.artifact_type = artifact_type
20412026
self.compile_method = compile_method
20422027
self.entrypoint = entrypoint

0 commit comments

Comments
 (0)