From 2af53b88d0b61344a18a59f7e9743f9a7aa9f060 Mon Sep 17 00:00:00 2001 From: kazhamiakin Date: Thu, 29 Aug 2024 14:58:35 +0200 Subject: [PATCH] Disable adapter support (not implemented in huggingfaceserver yet) --- .../huggingface/HuggingfaceServeRunner.java | 51 +++++++++---------- .../specs/HuggingfaceServeFunctionSpec.java | 18 +++---- 2 files changed, 34 insertions(+), 35 deletions(-) diff --git a/modules/runtime-model-serve/src/main/java/it/smartcommunitylabdhub/runtime/huggingface/HuggingfaceServeRunner.java b/modules/runtime-model-serve/src/main/java/it/smartcommunitylabdhub/runtime/huggingface/HuggingfaceServeRunner.java index 25847f3e..2b2fae29 100644 --- a/modules/runtime-model-serve/src/main/java/it/smartcommunitylabdhub/runtime/huggingface/HuggingfaceServeRunner.java +++ b/modules/runtime-model-serve/src/main/java/it/smartcommunitylabdhub/runtime/huggingface/HuggingfaceServeRunner.java @@ -181,33 +181,32 @@ public K8sRunnable produce(Run run) { args.add(taskSpec.getDtype().getDType()); } - if (functionSpec.getAdapters() != null && functionSpec.getAdapters().size() > 0) { - contextRefs = new LinkedList<>(contextRefs); - args.add("--enable-lora"); - args.add(Boolean.TRUE.toString()); - args.add("--lora-modules"); - - for (Map.Entry adapter : functionSpec.getAdapters().entrySet()) { - UriComponents adapterUri = UriComponentsBuilder.fromUriString(adapter.getValue()).build(); - String adapterSource = adapter.getValue().trim(); - String ref = adapterSource; + // if (functionSpec.getAdapters() != null && functionSpec.getAdapters().size() > 0) { + // contextRefs = new LinkedList<>(contextRefs); + // args.add("--enable-lora"); + // args.add("--lora-modules"); + + // for (Map.Entry adapter : functionSpec.getAdapters().entrySet()) { + // UriComponents adapterUri = UriComponentsBuilder.fromUriString(adapter.getValue()).build(); + // String adapterSource = adapter.getValue().trim(); + // String ref = adapterSource; - if (!"huggingface".equals(adapterUri.getScheme())) { - if (!adapterSource.endsWith("/")) adapterSource += "/"; - ref = "/shared/adapters/" + adapter.getKey() + "/"; - contextRefs = - Collections.singletonList( - ContextRef - .builder() - .source(adapterSource) - .protocol(adapterUri.getScheme()) - .destination("adapters/" + adapter.getKey()) - .build() - ); - } - args.add(adapter.getKey() + "=" + ref); - } - } + // if (!"huggingface".equals(adapterUri.getScheme())) { + // if (!adapterSource.endsWith("/")) adapterSource += "/"; + // ref = "/shared/adapters/" + adapter.getKey() + "/"; + // contextRefs = + // Collections.singletonList( + // ContextRef + // .builder() + // .source(adapterSource) + // .protocol(adapterUri.getScheme()) + // .destination("adapters/" + adapter.getKey()) + // .build() + // ); + // } + // args.add(adapter.getKey() + "=" + ref); + // } + // } CorePort servicePort = new CorePort(HTTP_PORT, HTTP_PORT); CorePort grpcPort = new CorePort(GRPC_PORT, GRPC_PORT); diff --git a/modules/runtime-model-serve/src/main/java/it/smartcommunitylabdhub/runtime/huggingface/specs/HuggingfaceServeFunctionSpec.java b/modules/runtime-model-serve/src/main/java/it/smartcommunitylabdhub/runtime/huggingface/specs/HuggingfaceServeFunctionSpec.java index 031b5b5f..bd50c658 100644 --- a/modules/runtime-model-serve/src/main/java/it/smartcommunitylabdhub/runtime/huggingface/specs/HuggingfaceServeFunctionSpec.java +++ b/modules/runtime-model-serve/src/main/java/it/smartcommunitylabdhub/runtime/huggingface/specs/HuggingfaceServeFunctionSpec.java @@ -24,17 +24,17 @@ ) public class HuggingfaceServeFunctionSpec extends ModelServeFunctionSpec { - @JsonProperty("adapters") - @Schema(title = "fields.huggingface.adapters.title", description = "fields.huggingface.adapters.description") - private Map adapters; + // @JsonProperty("adapters") + // @Schema(title = "fields.huggingface.adapters.title", description = "fields.huggingface.adapters.description") + // private Map adapters; - @Override - public void configure(Map data) { - super.configure(data); + // @Override + // public void configure(Map data) { + // super.configure(data); - HuggingfaceServeFunctionSpec spec = mapper.convertValue(data, HuggingfaceServeFunctionSpec.class); - this.adapters = spec.getAdapters(); - } + // HuggingfaceServeFunctionSpec spec = mapper.convertValue(data, HuggingfaceServeFunctionSpec.class); + // this.adapters = spec.getAdapters(); + // } public static HuggingfaceServeFunctionSpec with(Map data) { HuggingfaceServeFunctionSpec spec = new HuggingfaceServeFunctionSpec();