Skip to content

feat: Model Competitions - Model Contributors #278

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

Merged
merged 2 commits into from
Apr 3, 2025
Merged
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: 5 additions & 2 deletions polaris/model/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from polaris._artifact import BaseArtifactModel
from polaris.dataset.zarr import calculate_file_md5
from polaris.utils.errors import InvalidModelError
from polaris.utils.types import AccessType, HubOwner, HttpUrlString
from polaris.utils.types import AccessType, HubOwner, HttpUrlString, HubUser
from pathlib import Path
from pydantic import field_validator, computed_field
from pydantic import field_validator, computed_field, Field

# Constants
_SUPPORTED_MODEL_EXTENSIONS = [".onnx"]
Expand Down Expand Up @@ -37,6 +37,7 @@ class Model(BaseArtifactModel):
code_url (HttpUrlString | None): Optional URL pointing to the model's code repository.
report_url (HttpUrlString | None): Optional URL linking to a report or publication related to the model.
file_path (str | None): Optional path to a .onnx file containing the model.
contributors: The users credited with developing the model.
Methods:
upload_to_hub(access: AccessType = "private", owner: HubOwner | str | None = None):
Uploads the model artifact to the Polaris Hub, associating it with a specified owner and access level.
Expand All @@ -52,6 +53,8 @@ class Model(BaseArtifactModel):

file_path: str | None = None

contributors: list[HubUser] = Field(default_factory=list)

@field_validator("file_path")
@classmethod
def _validate_file(cls, v: str | None) -> str | None:
Expand Down