Update README.md
Browse files
README.md
CHANGED
|
@@ -1,28 +1,29 @@
|
|
| 1 |
---
|
| 2 |
-
license:
|
| 3 |
-
inference: false
|
| 4 |
---
|
| 5 |
|
| 6 |
# SLIM-TOPICS
|
| 7 |
|
| 8 |
<!-- Provide a quick summary of what the model is/does. -->
|
| 9 |
|
| 10 |
-
**slim-
|
| 11 |
|
| 12 |
-
slim-
|
| 13 |
|
| 14 |
-
`{
|
| 15 |
|
|
|
|
| 16 |
|
| 17 |
SLIM models are designed to generate structured outputs that can be used programmatically as part of a multi-step, multi-model LLM-based automation workflow.
|
| 18 |
|
| 19 |
-
Each slim model has a 'quantized tool' version, e.g., [**'slim-
|
| 20 |
|
| 21 |
|
| 22 |
## Prompt format:
|
| 23 |
|
| 24 |
`function = "classify"`
|
| 25 |
-
`params = "
|
| 26 |
`prompt = "<human> " + {text} + "\n" + `
|
| 27 |
`"<{function}> " + {params} + "</{function}>" + "\n<bot>:"`
|
| 28 |
|
|
@@ -30,8 +31,8 @@ Each slim model has a 'quantized tool' version, e.g., [**'slim-topics-tool'**](
|
|
| 30 |
<details>
|
| 31 |
<summary>Transformers Script </summary>
|
| 32 |
|
| 33 |
-
model = AutoModelForCausalLM.from_pretrained("llmware/slim-
|
| 34 |
-
tokenizer = AutoTokenizer.from_pretrained("llmware/slim-
|
| 35 |
|
| 36 |
function = "classify"
|
| 37 |
params = "topic"
|
|
@@ -73,8 +74,8 @@ Each slim model has a 'quantized tool' version, e.g., [**'slim-topics-tool'**](
|
|
| 73 |
<summary>Using as Function Call in LLMWare</summary>
|
| 74 |
|
| 75 |
from llmware.models import ModelCatalog
|
| 76 |
-
slim_model = ModelCatalog().load_model("llmware/slim-
|
| 77 |
-
response = slim_model.function_call(text,params=["
|
| 78 |
|
| 79 |
print("llmware - llm_response: ", response)
|
| 80 |
|
|
@@ -85,6 +86,4 @@ Each slim model has a 'quantized tool' version, e.g., [**'slim-topics-tool'**](
|
|
| 85 |
|
| 86 |
Darren Oberst & llmware team
|
| 87 |
|
| 88 |
-
[Join us on Discord](https://discord.gg/MhZn5Nc39h)
|
| 89 |
-
|
| 90 |
-
|
|
|
|
| 1 |
---
|
| 2 |
+
license: cc-by-sa-4.0
|
| 3 |
+
inference: false
|
| 4 |
---
|
| 5 |
|
| 6 |
# SLIM-TOPICS
|
| 7 |
|
| 8 |
<!-- Provide a quick summary of what the model is/does. -->
|
| 9 |
|
| 10 |
+
**slim-combo-sa-ner-3b** is part of the SLIM ("**S**tructured **L**anguage **I**nstruction **M**odel") model series, consisting of small, specialized decoder-based models, fine-tuned for function-calling.
|
| 11 |
|
| 12 |
+
slim-combo-sa-ner-3b combines two of the most popular traditional classifier functions (Sentiment Analysis and Named Entity Recognition), and reimagines them as function calls on a specialized decoder-based LLM, generating output consisting of a python dictionary with keys corresponding to sentiment, and NER identifiers, such as people, organization, and place, e.g.:
|
| 13 |
|
| 14 |
+
`{'sentiment': ['positive'], 'people': ['...'], 'organization': ['...'], 'place': [''] }`
|
| 15 |
|
| 16 |
+
This 'combo' model is designed to illustrate the potential power of using function calls on small, specialized models to enable a single model architecture to combine the capabilities of what were traditionally two separate model architectures on an encoder.
|
| 17 |
|
| 18 |
SLIM models are designed to generate structured outputs that can be used programmatically as part of a multi-step, multi-model LLM-based automation workflow.
|
| 19 |
|
| 20 |
+
Each slim model has a 'quantized tool' version, e.g., [**'slim-combo-tool-3b'**](https://huggingface.co/llmware/slim-combo-tool-3b).
|
| 21 |
|
| 22 |
|
| 23 |
## Prompt format:
|
| 24 |
|
| 25 |
`function = "classify"`
|
| 26 |
+
`params = "sentiment, person, organization, place"`
|
| 27 |
`prompt = "<human> " + {text} + "\n" + `
|
| 28 |
`"<{function}> " + {params} + "</{function}>" + "\n<bot>:"`
|
| 29 |
|
|
|
|
| 31 |
<details>
|
| 32 |
<summary>Transformers Script </summary>
|
| 33 |
|
| 34 |
+
model = AutoModelForCausalLM.from_pretrained("llmware/slim-combo-sa-ner-3b")
|
| 35 |
+
tokenizer = AutoTokenizer.from_pretrained("llmware/slim-combo-sa-ner-3b")
|
| 36 |
|
| 37 |
function = "classify"
|
| 38 |
params = "topic"
|
|
|
|
| 74 |
<summary>Using as Function Call in LLMWare</summary>
|
| 75 |
|
| 76 |
from llmware.models import ModelCatalog
|
| 77 |
+
slim_model = ModelCatalog().load_model("llmware/slim-combo-sa-ner-3b")
|
| 78 |
+
response = slim_model.function_call(text,params=["sentiment", "people", "organization", "place"], function="classify")
|
| 79 |
|
| 80 |
print("llmware - llm_response: ", response)
|
| 81 |
|
|
|
|
| 86 |
|
| 87 |
Darren Oberst & llmware team
|
| 88 |
|
| 89 |
+
[Join us on Discord](https://discord.gg/MhZn5Nc39h)
|
|
|
|
|
|