doberst commited on
Commit
81e29c0
·
verified ·
1 Parent(s): d723664

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +22 -64
README.md CHANGED
@@ -1,90 +1,48 @@
1
  ---
2
- license: apache-2.0
3
- inference: false
4
  ---
5
 
6
- # SLIM-TAGS-TOOL
7
 
8
  <!-- Provide a quick summary of what the model is/does. -->
9
 
10
- **slim-tags-tool** 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-sentiment has been fine-tuned for **generating relevant extractive summary tags** function calls, generating output consisting of a python dictionary corresponding to specified keys, e.g.:
13
 
14
- &nbsp;&nbsp;&nbsp;&nbsp;`{"tags": ["tag1", "tag2", "tag3", ... ]}`
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-tags-tool'**](https://huggingface.co/llmware/slim-tags-tool).
20
-
21
-
22
- ## Prompt format:
23
-
24
- `function = "classify"`
25
- `params = "tags"`
26
- `prompt = "<human> " + {text} + "\n" + `
27
- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;`"<{function}> " + {params} + "</{function}>" + "\n<bot>:"`
28
-
29
-
30
- <details>
31
- <summary>Transformers Script </summary>
32
-
33
- model = AutoModelForCausalLM.from_pretrained("llmware/slim-topics")
34
- tokenizer = AutoTokenizer.from_pretrained("llmware/slim-topics")
35
-
36
- function = "classify"
37
- params = "topic"
38
-
39
- text = "The stock market declined yesterday as investors worried increasingly about the slowing economy."
40
 
41
- prompt = "<human>: " + text + "\n" + f"<{function}> {params} </{function}>\n<bot>:"
42
-
43
- inputs = tokenizer(prompt, return_tensors="pt")
44
- start_of_input = len(inputs.input_ids[0])
45
 
46
- outputs = model.generate(
47
- inputs.input_ids.to('cpu'),
48
- eos_token_id=tokenizer.eos_token_id,
49
- pad_token_id=tokenizer.eos_token_id,
50
- do_sample=True,
51
- temperature=0.3,
52
- max_new_tokens=100
53
- )
54
 
55
- output_only = tokenizer.decode(outputs[0][start_of_input:], skip_special_tokens=True)
 
 
 
 
56
 
57
- print("output only: ", output_only)
 
58
 
59
- # here's the fun part
60
- try:
61
- output_only = ast.literal_eval(llm_string_output)
62
- print("success - converted to python dictionary automatically")
63
- except:
64
- print("fail - could not convert to python dictionary automatically - ", llm_string_output)
65
-
66
- </details>
67
-
68
- <details>
69
 
 
70
 
 
71
 
72
-
73
- <summary>Using as Function Call in LLMWare</summary>
 
74
 
75
- from llmware.models import ModelCatalog
76
- slim_model = ModelCatalog().load_model("llmware/slim-topics")
77
- response = slim_model.function_call(text,params=["topics"], function="classify")
78
 
79
- print("llmware - llm_response: ", response)
80
 
81
- </details>
82
 
83
-
84
  ## Model Card Contact
85
 
86
  Darren Oberst & llmware team
87
 
88
- [Join us on Discord](https://discord.gg/MhZn5Nc39h)
89
-
90
-
 
1
  ---
2
+ license: apache-2.0
 
3
  ---
4
 
5
+ # SLIM-TOPICS-TOOL
6
 
7
  <!-- Provide a quick summary of what the model is/does. -->
8
 
 
9
 
10
+ **slim-topics-tool** is a 4_K_M quantized GGUF version of slim-topics, providing a small, fast inference implementation, optimized for multi-model concurrent deployment.
11
 
12
+ [**slim-topics**](https://huggingface.co/llmware/slim-topics) is part of the SLIM ("**S**tructured **L**anguage **I**nstruction **M**odel") series, providing a set of small, specialized decoder-based LLMs, fine-tuned for function-calling.
13
 
14
+ To pull the model via API:
15
 
16
+ from huggingface_hub import snapshot_download
17
+ snapshot_download("llmware/slim-topics-tool", local_dir="/path/on/your/machine/", local_dir_use_symlinks=False)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
 
 
 
 
 
19
 
20
+ Load in your favorite GGUF inference engine, or try with llmware as follows:
 
 
 
 
 
 
 
21
 
22
+ from llmware.models import ModelCatalog
23
+
24
+ # to load the model and make a basic inference
25
+ model = ModelCatalog().load_model("slim-topics-tool")
26
+ response = model.function_call(text_sample)
27
 
28
+ # this one line will download the model and run a series of tests
29
+ ModelCatalog().tool_test_run("slim-topics-tool", verbose=True)
30
 
 
 
 
 
 
 
 
 
 
 
31
 
32
+ Slim models can also be loaded even more simply as part of a multi-model, multi-step LLMfx calls:
33
 
34
+ from llmware.agents import LLMfx
35
 
36
+ llm_fx = LLMfx()
37
+ llm_fx.load_tool("topics")
38
+ response = llm_fx.topics(text)
39
 
 
 
 
40
 
41
+ Note: please review [**config.json**](https://huggingface.co/llmware/slim-topics-tool/blob/main/config.json) in the repository for prompt wrapping information, details on the model, and full test set.
42
 
 
43
 
 
44
  ## Model Card Contact
45
 
46
  Darren Oberst & llmware team
47
 
48
+ [Any questions? Join us on Discord](https://discord.gg/MhZn5Nc39h)