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

fix: fix bugs in "det model describe" #1012

Merged
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
7 changes: 4 additions & 3 deletions cli/determined_cli/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,15 @@ def create(args: Namespace) -> None:

def describe(args: Namespace) -> None:
model = Determined(args.master, None).get_model(args.name)
checkpoint = model.get_version()
checkpoint = model.get_version(args.version)

if args.json:
print(json.dumps(model.to_json(), indent=2))
else:
render_model(model)
print("\n")
render_model_version(checkpoint)
if checkpoint is not None:
print("\n")
render_model_version(checkpoint)


def register_version(args: Namespace) -> None:
Expand Down
5 changes: 4 additions & 1 deletion common/determined_common/experimental/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def __init__(
self.last_updated_time = last_updated_time
self.metadata = metadata or {}

def get_version(self, version: int = 0) -> Checkpoint:
def get_version(self, version: int = 0) -> Optional[Checkpoint]:
"""
Retrieve the checkpoint corresponding to the specified version of the
model. If no version is specified the latest model version is returned.
Expand All @@ -67,6 +67,9 @@ def get_version(self, version: int = 0) -> Checkpoint:
)

data = resp.json()
if data["versions"] == []:
return None

latest_version = data["versions"][0]
return Checkpoint.from_json(
{
Expand Down
5 changes: 4 additions & 1 deletion e2e_tests/tests/test_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,10 @@ def test_model_registry() -> None:
checkpoint = d.get_experiment(exp_id).top_checkpoint()
model_version = mnist.register_version(checkpoint.uuid)
assert model_version.version == 1
assert mnist.get_version().uuid == checkpoint.uuid

latest_version = mnist.get_version()
assert latest_version is not None
assert latest_version.uuid == checkpoint.uuid

d.create_model("transformer", "all you need is attention")
d.create_model("object-detection", "a bounding box model")
Expand Down