Skip to content

Commit

Permalink
Support adapters by properties (deepjavalibrary#1148)
Browse files Browse the repository at this point in the history
  • Loading branch information
zachgk authored Oct 4, 2023
1 parent 8eb790b commit ac5e7a3
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions engines/python/setup/djl_python/huggingface.py
Original file line number Diff line number Diff line change
Expand Up @@ -589,12 +589,18 @@ def _read_model_config(self, model_config_path: str, revision=None):
raise e

def _fetch_adapters_from_input(self, input_map: dict, input: Input):
adapters = input_map.pop("adapters", [])
if not adapters:
## check if input contains adapters, possible in workflow approach
if input.contains_key("adapter"):
adapters = input.get_as_string("adapter")
return adapters
if "adapters" in input_map:
return input_map.pop("adapters", [])

# check content, possible in workflow approach
if input.contains_key("adapter"):
return input.get_as_string("adapter")

# check properties, possible from header
if "adapter" in input.get_properties():
return input.get_properties()["adapter"]

return []


_service = HuggingFaceService()
Expand Down

0 comments on commit ac5e7a3

Please sign in to comment.