Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/add/deploy flag #2569

Merged
merged 3 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix existing templates
- Add optional data insert to `Table`
- Make Lance vector searcher as plugin.
- Remove job dependencies from job metadata

#### New Features & Functionality

Expand Down Expand Up @@ -77,6 +78,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Updated llm_finetuning template
- Add sql table length exceed limit and uuid truncation.
- Add ci workflow to test templates
- Add deploy flag in model.

#### Bug Fixes

Expand Down
1 change: 1 addition & 0 deletions superduper/base/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def dict(self):
_base_dict = dc.asdict(self)
if 'time' in _base_dict:
_base_dict['time'] = str(_base_dict['time'])
_base_dict.pop('dependencies', None)
return {
**_base_dict,
'genus': self.genus,
Expand Down
1 change: 0 additions & 1 deletion superduper/components/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,6 @@ def declare_component(self, cluster):
if self.cache:
logging.info(f'Adding {self.type_id}: {self.identifier} to cache')
cluster.cache.put(self)
cluster.compute.put(self)

def on_load(self, db: Datalayer) -> None:
"""Called when this component is loaded from the data store.
Expand Down
6 changes: 5 additions & 1 deletion superduper/components/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ class Model(Component, metaclass=ModelMeta):
``compute_kwargs`` on a distributed cluster.
:param trainer: `Trainer` instance to use for training.
:param example: An example to auto-determine the schema/ datatype.
:param deploy: Creates a standalone class instance on compute cluster.
"""

type_id: t.ClassVar[str] = 'model'
Expand All @@ -387,6 +388,7 @@ class Model(Component, metaclass=ModelMeta):
serve: bool = False
trainer: t.Optional[Trainer] = None
example: dc.InitVar[t.Any | None] = None
deploy: bool = False

def __post_init__(self, db, artifacts, example):
super().__post_init__(db, artifacts)
Expand All @@ -407,7 +409,9 @@ def _wrapper(self, data):

def declare_component(self, cluster):
"""Declare model on compute."""
cluster.compute.put(self)
super().declare_component(cluster)
if self.deploy or self.serve:
cluster.compute.put(self)

@abstractmethod
def predict(self, *args, **kwargs) -> t.Any:
Expand Down
Loading