初始化项目,由ModelHub XC社区提供模型
Model: llmware/slim-topics Source: Original Platform
This commit is contained in:
35
.gitattributes
vendored
Normal file
35
.gitattributes
vendored
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.arrow filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ftz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.h5 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.joblib filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.model filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.npy filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.npz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.onnx filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ot filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.parquet filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pb filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pickle filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pkl filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pt filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pth filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.rar filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||||
|
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tar filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tflite filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.wasm filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zst filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
||||||
90
README.md
Normal file
90
README.md
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
---
|
||||||
|
license: apache-2.0
|
||||||
|
inference: false
|
||||||
|
---
|
||||||
|
|
||||||
|
# SLIM-TOPICS
|
||||||
|
|
||||||
|
<!-- Provide a quick summary of what the model is/does. -->
|
||||||
|
|
||||||
|
**slim-topics** 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.
|
||||||
|
|
||||||
|
slim-sentiment has been fine-tuned for **topic analysis** function calls, generating output consisting of a python dictionary corresponding to specified keys, e.g.:
|
||||||
|
|
||||||
|
`{"topics": ["..."]}`
|
||||||
|
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
Each slim model has a 'quantized tool' version, e.g., [**'slim-topics-tool'**](https://huggingface.co/llmware/slim-topics-tool).
|
||||||
|
|
||||||
|
|
||||||
|
## Prompt format:
|
||||||
|
|
||||||
|
`function = "classify"`
|
||||||
|
`params = "topics"`
|
||||||
|
`prompt = "<human> " + {text} + "\n" + `
|
||||||
|
`"<{function}> " + {params} + "</{function}>" + "\n<bot>:"`
|
||||||
|
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Transformers Script </summary>
|
||||||
|
|
||||||
|
model = AutoModelForCausalLM.from_pretrained("llmware/slim-topics")
|
||||||
|
tokenizer = AutoTokenizer.from_pretrained("llmware/slim-topics")
|
||||||
|
|
||||||
|
function = "classify"
|
||||||
|
params = "topic"
|
||||||
|
|
||||||
|
text = "The stock market declined yesterday as investors worried increasingly about the slowing economy."
|
||||||
|
|
||||||
|
prompt = "<human>: " + text + "\n" + f"<{function}> {params} </{function}>\n<bot>:"
|
||||||
|
|
||||||
|
inputs = tokenizer(prompt, return_tensors="pt")
|
||||||
|
start_of_input = len(inputs.input_ids[0])
|
||||||
|
|
||||||
|
outputs = model.generate(
|
||||||
|
inputs.input_ids.to('cpu'),
|
||||||
|
eos_token_id=tokenizer.eos_token_id,
|
||||||
|
pad_token_id=tokenizer.eos_token_id,
|
||||||
|
do_sample=True,
|
||||||
|
temperature=0.3,
|
||||||
|
max_new_tokens=100
|
||||||
|
)
|
||||||
|
|
||||||
|
output_only = tokenizer.decode(outputs[0][start_of_input:], skip_special_tokens=True)
|
||||||
|
|
||||||
|
print("output only: ", output_only)
|
||||||
|
|
||||||
|
# here's the fun part
|
||||||
|
try:
|
||||||
|
output_only = ast.literal_eval(llm_string_output)
|
||||||
|
print("success - converted to python dictionary automatically")
|
||||||
|
except:
|
||||||
|
print("fail - could not convert to python dictionary automatically - ", llm_string_output)
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<summary>Using as Function Call in LLMWare</summary>
|
||||||
|
|
||||||
|
from llmware.models import ModelCatalog
|
||||||
|
slim_model = ModelCatalog().load_model("llmware/slim-topics")
|
||||||
|
response = slim_model.function_call(text,params=["topics"], function="classify")
|
||||||
|
|
||||||
|
print("llmware - llm_response: ", response)
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
|
||||||
|
## Model Card Contact
|
||||||
|
|
||||||
|
Darren Oberst & llmware team
|
||||||
|
|
||||||
|
[Join us on Discord](https://discord.gg/MhZn5Nc39h)
|
||||||
|
|
||||||
|
|
||||||
89
config.json
Normal file
89
config.json
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
{
|
||||||
|
"aib_version": "model_archive_122723_tiny_llama-1.1b-29",
|
||||||
|
"training_dataset": [
|
||||||
|
"aib_label_samples_524s.jsonl"
|
||||||
|
],
|
||||||
|
"training_timestamp": "Wed Dec 27 17:43:21 2023",
|
||||||
|
"training_comments": "tiny-llama-1.1b-27",
|
||||||
|
"vocab_size": 32000,
|
||||||
|
"max_position_embeddings": 2048,
|
||||||
|
"hidden_size": 2048,
|
||||||
|
"intermediate_size": 5632,
|
||||||
|
"num_hidden_layers": 22,
|
||||||
|
"num_attention_heads": 32,
|
||||||
|
"num_key_value_heads": 4,
|
||||||
|
"hidden_act": "silu",
|
||||||
|
"initializer_range": 0.02,
|
||||||
|
"rms_norm_eps": 1e-05,
|
||||||
|
"pretraining_tp": 1,
|
||||||
|
"use_cache": true,
|
||||||
|
"rope_theta": 10000.0,
|
||||||
|
"rope_scaling": null,
|
||||||
|
"attention_bias": false,
|
||||||
|
"attention_dropout": 0.0,
|
||||||
|
"return_dict": true,
|
||||||
|
"output_hidden_states": false,
|
||||||
|
"output_attentions": false,
|
||||||
|
"torchscript": false,
|
||||||
|
"torch_dtype": "float32",
|
||||||
|
"use_bfloat16": false,
|
||||||
|
"tf_legacy_loss": false,
|
||||||
|
"pruned_heads": {},
|
||||||
|
"tie_word_embeddings": false,
|
||||||
|
"is_encoder_decoder": false,
|
||||||
|
"is_decoder": false,
|
||||||
|
"cross_attention_hidden_size": null,
|
||||||
|
"add_cross_attention": false,
|
||||||
|
"tie_encoder_decoder": false,
|
||||||
|
"max_length": 20,
|
||||||
|
"min_length": 0,
|
||||||
|
"do_sample": false,
|
||||||
|
"early_stopping": false,
|
||||||
|
"num_beams": 1,
|
||||||
|
"num_beam_groups": 1,
|
||||||
|
"diversity_penalty": 0.0,
|
||||||
|
"temperature": 1.0,
|
||||||
|
"top_k": 50,
|
||||||
|
"top_p": 1.0,
|
||||||
|
"typical_p": 1.0,
|
||||||
|
"repetition_penalty": 1.0,
|
||||||
|
"length_penalty": 1.0,
|
||||||
|
"no_repeat_ngram_size": 0,
|
||||||
|
"encoder_no_repeat_ngram_size": 0,
|
||||||
|
"bad_words_ids": null,
|
||||||
|
"num_return_sequences": 1,
|
||||||
|
"chunk_size_feed_forward": 0,
|
||||||
|
"output_scores": false,
|
||||||
|
"return_dict_in_generate": false,
|
||||||
|
"forced_bos_token_id": null,
|
||||||
|
"forced_eos_token_id": null,
|
||||||
|
"remove_invalid_values": false,
|
||||||
|
"exponential_decay_length_penalty": null,
|
||||||
|
"suppress_tokens": null,
|
||||||
|
"begin_suppress_tokens": null,
|
||||||
|
"architectures": [
|
||||||
|
"LlamaForCausalLM"
|
||||||
|
],
|
||||||
|
"finetuning_task": null,
|
||||||
|
"id2label": {
|
||||||
|
"0": "LABEL_0",
|
||||||
|
"1": "LABEL_1"
|
||||||
|
},
|
||||||
|
"label2id": {
|
||||||
|
"LABEL_0": 0,
|
||||||
|
"LABEL_1": 1
|
||||||
|
},
|
||||||
|
"tokenizer_class": null,
|
||||||
|
"prefix": null,
|
||||||
|
"bos_token_id": 1,
|
||||||
|
"pad_token_id": null,
|
||||||
|
"eos_token_id": 2,
|
||||||
|
"sep_token_id": null,
|
||||||
|
"decoder_start_token_id": null,
|
||||||
|
"task_specific_params": null,
|
||||||
|
"problem_type": null,
|
||||||
|
"_name_or_path": "TinyLlama/TinyLlama-1.1B-intermediate-step-1195k-token-2.5T",
|
||||||
|
"transformers_version": "4.36.1",
|
||||||
|
"model_type": "llama",
|
||||||
|
"trained": "custom training"
|
||||||
|
}
|
||||||
7
generation_config.json
Normal file
7
generation_config.json
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"bos_token_id": 1,
|
||||||
|
"eos_token_id": 2,
|
||||||
|
"pad_token_id": 0,
|
||||||
|
"max_length": 2048,
|
||||||
|
"transformers_version": "4.31.0.dev0"
|
||||||
|
}
|
||||||
3
pytorch_model.bin
Normal file
3
pytorch_model.bin
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:5ac097221204bc48e76b83fb5151f94e385163e0a030083c7081fc5dcacbff9f
|
||||||
|
size 2200181102
|
||||||
23
special_tokens_map.json
Normal file
23
special_tokens_map.json
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"bos_token": {
|
||||||
|
"content": "<s>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false
|
||||||
|
},
|
||||||
|
"eos_token": {
|
||||||
|
"content": "</s>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false
|
||||||
|
},
|
||||||
|
"unk_token": {
|
||||||
|
"content": "<unk>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false
|
||||||
|
}
|
||||||
|
}
|
||||||
93391
tokenizer.json
Normal file
93391
tokenizer.json
Normal file
File diff suppressed because it is too large
Load Diff
BIN
tokenizer.model
(Stored with Git LFS)
Normal file
BIN
tokenizer.model
(Stored with Git LFS)
Normal file
Binary file not shown.
35
tokenizer_config.json
Normal file
35
tokenizer_config.json
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
{
|
||||||
|
"add_bos_token": true,
|
||||||
|
"add_eos_token": false,
|
||||||
|
"bos_token": {
|
||||||
|
"__type": "AddedToken",
|
||||||
|
"content": "<s>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false
|
||||||
|
},
|
||||||
|
"clean_up_tokenization_spaces": false,
|
||||||
|
"eos_token": {
|
||||||
|
"__type": "AddedToken",
|
||||||
|
"content": "</s>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false
|
||||||
|
},
|
||||||
|
"legacy": false,
|
||||||
|
"model_max_length": 1000000000000000019884624838656,
|
||||||
|
"pad_token": null,
|
||||||
|
"padding_side": "right",
|
||||||
|
"sp_model_kwargs": {},
|
||||||
|
"tokenizer_class": "LlamaTokenizer",
|
||||||
|
"unk_token": {
|
||||||
|
"__type": "AddedToken",
|
||||||
|
"content": "<unk>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user