Skip to content

Commit

Permalink
Disable adapter support (not implemented in huggingfaceserver yet)
Browse files Browse the repository at this point in the history
  • Loading branch information
kazhamiakin committed Aug 29, 2024
1 parent 7512aa5 commit 2af53b8
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, String> 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<String, String> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@
)
public class HuggingfaceServeFunctionSpec extends ModelServeFunctionSpec {

@JsonProperty("adapters")
@Schema(title = "fields.huggingface.adapters.title", description = "fields.huggingface.adapters.description")
private Map<String, String> adapters;
// @JsonProperty("adapters")
// @Schema(title = "fields.huggingface.adapters.title", description = "fields.huggingface.adapters.description")
// private Map<String, String> adapters;

@Override
public void configure(Map<String, Serializable> data) {
super.configure(data);
// @Override
// public void configure(Map<String, Serializable> 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<String, Serializable> data) {
HuggingfaceServeFunctionSpec spec = new HuggingfaceServeFunctionSpec();
Expand Down

0 comments on commit 2af53b8

Please sign in to comment.