Skip to content

Commit

Permalink
Cosem starter (#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
mzouink authored Mar 18, 2024
2 parents 18f9f95 + 92858b2 commit 851e3bc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 16 deletions.
15 changes: 2 additions & 13 deletions dacapo/experiments/starts/cosem_start.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,10 @@
logger = logging.getLogger(__file__)


def format_name(name):
if "/" in name:
run, criterion = name.split("/")
return run, criterion
else:
raise ValueError(
f"Invalid starter name format {name}. Must be in the format run/criterion"
)


class CosemStart(Start):
def __init__(self, start_config):
run, criterion = format_name(start_config.name)
self.name = start_config.name
super().__init__(run, criterion)
self.name = f"{self.run}/{self.criterion}"
super().__init__(start_config)

def initialize_weights(self, model):
from dacapo.store.create_store import create_weights_store
Expand Down
5 changes: 2 additions & 3 deletions dacapo/experiments/starts/cosem_start_config.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import attr
from .cosem_start import CosemStart
from .start_config import StartConfig


@attr.s
class CosemStartConfig:
class CosemStartConfig(StartConfig):
"""Starter for COSEM pretained models. This is a subclass of `StartConfig` and
should be used to initialize the model with pretrained weights from a previous
run.
"""

start_type = CosemStart

name: str = attr.ib(metadata={"help_text": "The COSEM checkpoint name to use."})

0 comments on commit 851e3bc

Please sign in to comment.