Skip to content

Commit

Permalink
fix: postpone the model id normalization for huggingface models
Browse files Browse the repository at this point in the history
Signed-off-by: Frost Ming <[email protected]>
  • Loading branch information
frostming committed Nov 4, 2024
1 parent c92dcd0 commit 39d1161
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/_bentoml_sdk/models/huggingface.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class HuggingFaceModel(Model[str]):
str: The downloaded model path.
"""

model_id: str = attrs.field(converter=str.lower)
model_id: str
revision: str = "main"
endpoint: str | None = attrs.field(factory=lambda: os.getenv("HF_ENDPOINT"))

Expand Down Expand Up @@ -77,13 +77,14 @@ def resolve(self, base_path: t.Union[PathType, FS, None] = None) -> str:
return snapshot_path

def to_info(self, alias: str | None = None) -> BentoModelInfo:
tag = Tag(self.model_id.replace("/", "--"), self.commit_hash)
model_id = self.model_id.lower()
tag = Tag(model_id.replace("/", "--"), self.commit_hash)
return BentoModelInfo(
tag,
alias=alias,
registry="huggingface",
metadata={
"model_id": self.model_id,
"model_id": model_id,
"revision": self.commit_hash,
"endpoint": self.endpoint or DEFAULT_HF_ENDPOINT,
},
Expand Down

0 comments on commit 39d1161

Please sign in to comment.