初始化项目,由ModelHub XC社区提供模型

Model: saadxsalman/SS-Talk-2-Bash
Source: Original Platform
This commit is contained in:
ModelHub XC
2026-04-30 19:27:34 +08:00
commit fb3efda266
9 changed files with 324131 additions and 0 deletions

36
.gitattributes vendored Normal file
View File

@@ -0,0 +1,36 @@
*.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
ss-talk-2-bash.Q8_0.gguf filter=lfs diff=lfs merge=lfs -text

103
README.md Normal file
View File

@@ -0,0 +1,103 @@
---
language:
- en
license: apache-2.0
library_name: peft
pipeline_tag: text-generation
base_model: LiquidAI/LFM2.5-350M
tags:
- bash
- terminal
- devops
- linux
- hardcoded
- lfm
datasets:
- emirkaanozdemr/bash_command_data_6K
model_creator: saadxsalman
widget:
- text: "[NL] find all files larger than 100MB in the current directory [CL]"
example_title: "Find Large Files"
- text: "[NL] list all files in long format including hidden ones [CL]"
example_title: "List All Files"
inference:
parameters:
do_sample: false
temperature: 0.0
max_new_tokens: 64
---
# SS-Talk-2-Bash (LFM-350M-Hardcoded)
This model is a fine-tuned version of **LiquidAI/LFM2.5-350M** designed specifically for deterministic natural language to Bash command translation. It uses a **Strict Hard-Coding** training method to minimize linguistic "chatter" and maximize structural accuracy.
---
## 1. Model Description
* **Developed by:** saadxsalman
* **Model type:** Causal Language Model (LFM)
* **Language(s):** English (Input) to Bash (Output)
* **License:** Apache 2.0
* **Finetuned from model:** LiquidAI/LFM2.5-350M
---
## 2. Training Strategy: "The Hard-Coding Engine"
Unlike standard instruction-tuned models that learn to be "helpful assistants," this model was trained using a **Masking Collator** strategy:
* **Label Masking:** All natural language tokens (the prompt) are masked during training ($loss = -100$). The model only calculates loss on the Bash command itself.
* **Zero Chatter:** The model does not learn to say "Sure, here is your command." It is trained to jump directly from the `[CL]` token to the syntax.
* **Greedy Decoding:** The `generation_config.json` is locked to `do_sample: False` and `temperature: 0.0` to ensure the same input always produces the same output.
---
## 3. Training Data
The model was fine-tuned on the `emirkaanozdemr/bash_command_data_6K` dataset. The data was restructured into a rigid non-linguistic format:
`[NL] {Natural Language Prompt} [CL] {Bash Command} [END]`
---
## 4. Intended Use & Prompting
To get the best results, you **must** use the specific trigger tokens used during training.
**Correct Prompt Format:**
`[NL] find all files larger than 100MB in the current directory [CL]`
---
## 5. How to Use (Inference)
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "saadxsalman/SS-Talk-2-Bash"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto")
prompt = "[NL] list all files in long format [CL]"
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=64)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
```
---
## 6. Limitations and Biases
* **Logic Only:** This model has "forgotten" how to converse. It will not answer general questions or write Python code.
* **Bash Specific:** It is optimized for standard Linux Bash commands. It may struggle with complex shell scripting logic if not represented in the 6K training samples.
* **Formatting Sensitive:** If the `[NL]` or `[CL]` tokens are omitted, the model performance will degrade significantly.
---
## 7. Training Hyperparameters
| Parameter | Value |
| :--- | :--- |
| **Learning Rate** | $1 \times 10^{-4}$ |
| **Optimizer** | Paged AdamW 8-bit |
| **LoRA R** | 64 |
| **LoRA Alpha** | 128 |
| **Batch Size** | 16 (4 per device $\times$ 4 grad accum) |
| **Precision** | Mixed Precision (FP16) |
```

64
chat_template.jinja Normal file
View File

@@ -0,0 +1,64 @@
{{- bos_token -}}
{%- set keep_past_thinking = keep_past_thinking | default(false) -%}
{%- set ns = namespace(system_prompt="") -%}
{%- if messages[0]["role"] == "system" -%}
{%- set sys_content = messages[0]["content"] -%}
{%- if sys_content is not string -%}
{%- for item in sys_content -%}
{%- if item["type"] == "text" -%}
{%- set ns.system_prompt = ns.system_prompt + item["text"] -%}
{%- endif -%}
{%- endfor -%}
{%- else -%}
{%- set ns.system_prompt = sys_content -%}
{%- endif -%}
{%- set messages = messages[1:] -%}
{%- endif -%}
{%- if tools -%}
{%- set ns.system_prompt = ns.system_prompt + ("\n" if ns.system_prompt else "") + "List of tools: [" -%}
{%- for tool in tools -%}
{%- if tool is not string -%}
{%- set tool = tool | tojson -%}
{%- endif -%}
{%- set ns.system_prompt = ns.system_prompt + tool -%}
{%- if not loop.last -%}
{%- set ns.system_prompt = ns.system_prompt + ", " -%}
{%- endif -%}
{%- endfor -%}
{%- set ns.system_prompt = ns.system_prompt + "]" -%}
{%- endif -%}
{%- if ns.system_prompt -%}
{{- "<|im_start|>system\n" + ns.system_prompt + "<|im_end|>\n" -}}
{%- endif -%}
{%- set ns.last_assistant_index = -1 -%}
{%- for message in messages -%}
{%- if message["role"] == "assistant" -%}
{%- set ns.last_assistant_index = loop.index0 -%}
{%- endif -%}
{%- endfor -%}
{%- for message in messages -%}
{{- "<|im_start|>" + message["role"] + "\n" -}}
{%- set content = message["content"] -%}
{%- if content is not string -%}
{%- set ns.content = "" -%}
{%- for item in content -%}
{%- if item["type"] == "image" -%}
{%- set ns.content = ns.content + "<image>" -%}
{%- elif item["type"] == "text" -%}
{%- set ns.content = ns.content + item["text"] -%}
{%- else -%}
{%- set ns.content = ns.content + item | tojson -%}
{%- endif -%}
{%- endfor -%}
{%- set content = ns.content -%}
{%- endif -%}
{%- if message["role"] == "assistant" and not keep_past_thinking and loop.index0 != ns.last_assistant_index -%}
{%- if "</think>" in content -%}
{%- set content = content.split("</think>")[-1] | trim -%}
{%- endif -%}
{%- endif -%}
{{- content + "<|im_end|>\n" -}}
{%- endfor -%}
{%- if add_generation_prompt -%}
{{- "<|im_start|>assistant\n" -}}
{%- endif -%}

61
config.json Normal file
View File

@@ -0,0 +1,61 @@
{
"architectures": [
"Lfm2ForCausalLM"
],
"block_auto_adjust_ff_dim": true,
"block_dim": 1024,
"block_ff_dim": 6656,
"block_ffn_dim_multiplier": 1.0,
"block_mlp_init_scale": 1.0,
"block_multiple_of": 256,
"block_norm_eps": 1e-05,
"block_out_init_scale": 1.0,
"block_use_swiglu": true,
"block_use_xavier_init": true,
"bos_token_id": 1,
"conv_L_cache": 3,
"conv_bias": false,
"conv_dim": 1024,
"conv_use_xavier_init": true,
"dtype": "float16",
"eos_token_id": 7,
"hidden_size": 1024,
"initializer_range": 0.02,
"intermediate_size": 6656,
"layer_types": [
"conv",
"conv",
"full_attention",
"conv",
"conv",
"full_attention",
"conv",
"conv",
"full_attention",
"conv",
"full_attention",
"conv",
"full_attention",
"conv",
"full_attention",
"conv"
],
"max_position_embeddings": 128000,
"model_type": "lfm2",
"norm_eps": 1e-05,
"num_attention_heads": 16,
"num_heads": 16,
"num_hidden_layers": 16,
"num_key_value_heads": 8,
"pad_token_id": 0,
"rope_parameters": {
"rope_theta": 1000000.0,
"rope_type": "default"
},
"tie_embedding": true,
"tie_word_embeddings": true,
"transformers_version": "5.0.0",
"use_cache": true,
"use_pos_enc": true,
"vocab_size": 65536
}

10
generation_config.json Normal file
View File

@@ -0,0 +1,10 @@
{
"do_sample": false,
"temperature": 0.0,
"top_p": 1.0,
"num_beams": 1,
"max_new_tokens": 128,
"eos_token_id": 7,
"pad_token_id": 0,
"transformers_version": "4.38.0"
}

3
model.safetensors Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7148cb24393b2529de6fe6516bba8d8727c79a88a72aef82b06df7e1a6174b18
size 708984312

3
ss-talk-2-bash.Q8_0.gguf Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8d546aa98cfb1750d056c374f4373670e59a901a83aa82935f91e96639f5cc91
size 379217056

323830
tokenizer.json Normal file

File diff suppressed because it is too large Load Diff

21
tokenizer_config.json Normal file
View File

@@ -0,0 +1,21 @@
{
"backend": "tokenizers",
"bos_token": "<|startoftext|>",
"clean_up_tokenization_spaces": false,
"eos_token": "<|im_end|>",
"extra_special_tokens": [],
"is_local": false,
"legacy": false,
"model_input_names": [
"input_ids",
"attention_mask"
],
"model_max_length": 1000000000000000019884624838656,
"model_specific_special_tokens": {},
"pad_token": "<|pad|>",
"sp_model_kwargs": {},
"spaces_between_special_tokens": false,
"tokenizer_class": "TokenizersBackend",
"use_default_system_prompt": false,
"use_fast": true
}