Skip to content

Commit

Permalink
Configurable model list for stormtrooper processor
Browse files Browse the repository at this point in the history
  • Loading branch information
stijn-uva committed Oct 11, 2024
1 parent db5b649 commit d399921
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions processors/machine_learning/annotate_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ class TextClassifier(BasicProcessor):
"type": UserInput.OPTION_TOGGLE,
"default": False,
"help": "Enable LLM-powered text classification",
},
"dmi-service-manager.stormtrooper_models": {
"type": UserInput.OPTION_TEXT,
"default": "google/flan-t5-large,tiiaue/falcon-7b-instruct",
"help": "Comma-separated list of models that can be selected"
}
}

Expand All @@ -53,8 +58,6 @@ class TextClassifier(BasicProcessor):
"type": UserInput.OPTION_CHOICE,
"default": "google/flan-t5-large",
"options": {
"google/flan-t5-large": "google/flan-t5-large",
"tiiaue/falcon-7b-instruct": "tiiaue/falcon-7b-instruct"
},
"help": "Large Language Model to use"
},
Expand Down Expand Up @@ -97,6 +100,10 @@ def get_options(cls, parent_dataset=None, user=None):
:return dict: Processor options
"""
options = cls.options

models = config.get("dmi-service-manager.stormtrooper_models", user=user).split(",")
options["model"]["options"] = {m: m for m in models}

if parent_dataset is None:
return options

Expand Down

0 comments on commit d399921

Please sign in to comment.