Skip to content

Commit

Permalink
Basic logic
Browse files Browse the repository at this point in the history
  • Loading branch information
htahir1 committed Jan 23, 2024
1 parent 39a4a4e commit 455439a
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions llm-finetuning/huggingface/hf_model_deployer.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ def _create_new_service(
"""
# create a new service for the new model
service = HuggingFaceDeploymentService(config)

from zenml import save_artifact, log_artifact_metadata
save_artifact(service, "hf_deployment_service", str(service_metadata["uuid"]))
service_metadata = service.dict()
# UUID object is not json serializable
service_metadata["uuid"] = str(service_metadata["uuid"])
log_artifact_metadata(metadata={"hf_deployment_service": service_metadata})

service.start(timeout=timeout)
return service

Expand Down Expand Up @@ -198,6 +206,14 @@ def find_model_server(
if running and not service.is_running:
# skip non-running services
continue

from zenml.client import Client
from zenml.services import ServiceRegistry
client = Client()
service_artifact = client.get_artifact_version("hf_deployment_service", str(service_uuid))
hf_deployment_service_dict = service_artifact.metadata["hf_deployment_service"]
ServiceRegistry().load_service_from_dict(hf_deployment_service_dict)

services.append(service)

return services
Expand Down

0 comments on commit 455439a

Please sign in to comment.