Skip to content
This repository has been archived by the owner on Sep 13, 2023. It is now read-only.

Expose GTO version in FastAPI's interface #681

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

aguschin
Copy link
Contributor

@aguschin aguschin commented May 30, 2023

close #665

If you do:

git clone https://github.com/iterative/example-gto
cd example-gto
git checkout mlem
mlem --tb serve fastapi -m models/churn.pkl

You'll see model version on the last line:

image

TODO:

  • add tests
  • rename "version" to "mlem_version"
  • review implementation - rough and needs to be refined

@aguschin aguschin requested a review from a team as a code owner May 30, 2023 11:14
@aguschin aguschin self-assigned this May 30, 2023
@aguschin aguschin temporarily deployed to internal May 30, 2023 11:14 — with GitHub Actions Inactive
@aguschin aguschin temporarily deployed to internal May 30, 2023 12:03 — with GitHub Actions Inactive
root = find_dvc_repo_root(path)
relpath = os.path.relpath(path, root)
if relpath.endswith(".mlem"):
relpath = relpath[:-5]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
relpath = relpath[:-5]
relpath = relpath.rstrip(".mlem")


version = _show_versions(root, name, ref="HEAD")
if version:
return version[0]["version"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To make this more flexible and support other version metadata, I suggest version to return a json object and not a string

  • GTO version implementation will now return {"semver": <VERSION>}
  • obvious next steps in the future would be to add git version information (branch, git rev).

this will also make it possible to return some version information even if there's no GTO tracking and also support other version in the future, like people manually git-tagging, not via gto

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expose GTO's model version in FastAPI's interface.json
2 participants