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

Update to work with caikit 0.25.x #27

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
8 changes: 3 additions & 5 deletions caikit_huggingface_demo/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def _get_module_models(model_manager=None) -> dict:
"""
if model_manager:
model_modules = {
k: v.module().metadata["module_id"]
k: v.model().MODULE_ID
for (k, v) in model_manager.loaded_models.items()
}
else:
Expand Down Expand Up @@ -125,7 +125,7 @@ def start_frontend(backend, inference_service):
module_models = _get_module_models(model_manager)
# Channel and stub is for client
port = (
get_config().runtime.port if not backend else backend.port
get_config().runtime.grpc.port if not backend else backend.port
) # Using the actual port when we have a backend
target = f"localhost:{port}"
channel = grpc.insecure_channel(target)
Expand All @@ -146,9 +146,7 @@ def main() -> int:

if backend:
print("▶️ Starting the backend Caikit inference server...")
with RuntimeGRPCServer(
inference_service=inference_service, training_service=None
) as backend:
with RuntimeGRPCServer() as backend:
if frontend:
start_frontend(backend, inference_service) # and wait for termination
else:
Expand Down
6 changes: 4 additions & 2 deletions caikit_huggingface_demo/client/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,10 @@ def get_frontend(
reflection_db = ProtoReflectionDescriptorDatabase(channel)
desc_pool = DescriptorPool(reflection_db)
services = [
x for x in reflection_db.get_services() if x.startswith("caikit.runtime.")
]
x for x in reflection_db.get_services() if x.startswith("caikit.runtime.") and not(
x.endswith("InfoService") or x.endswith("TrainingService")
) and not (
x.startswith("caikit.runtime.training") or x.startswith("caikit.runtime.training"))]
if len(services) != 1:
print(f"Error: Expected 1 caikit.runtime service, but found {len(services)}.")
service_name = services[0]
Expand Down
7 changes: 2 additions & 5 deletions caikit_huggingface_demo/runtime/config/config.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
runtime:
# The runtime library (or libraries) whose models we want to serve using Caikit Runtime. This should
# be a snake case string, e.g., caikit_nlp or caikit_cv.
library: runtime
local_models_dir: models
# Service exposure options
port: 8085
find_available_port: True
# grpc:
# port: 8085
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
caikit[all]==0.10.1
caikit[all]==0.25.6
requests==2.31.0
Pillow==9.5.0
click==8.1.3
Expand Down
Loading