commit 528530326ce8ce40eb9282c0bef659633465639e Author: ModelHub XC Date: Fri May 1 02:18:27 2026 +0800 初始化项目,由ModelHub XC社区提供模型 Model: ReXeeD/TASX-Cmd-0.5B Source: Original Platform diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..52373fe --- /dev/null +++ b/.gitattributes @@ -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 +tokenizer.json filter=lfs diff=lfs merge=lfs -text diff --git a/README.md b/README.md new file mode 100644 index 0000000..ed56ab3 --- /dev/null +++ b/README.md @@ -0,0 +1,140 @@ +--- +language: +- en +tags: +- robotics +- ros2 +- json +- unsloth +- qwen +- text-generation +- hardware +base_model: unsloth/Qwen2.5-0.5B-Instruct +pipeline_tag: text-generation +license: apache-2.0 +--- + +# TASX-Command-0.5B + +**TASX-Command-0.5B** is a highly specialized, lightweight language model designed specifically for robotics. It translates natural language (including slang, typos, and complex phrasing) into strict, execution-ready JSON command sequences for ROS2, SLAM, and physical robot control. + +By fine-tuning the **Qwen2.5-0.5B** base model, we created a "robot brain" that is small and fast enough to run locally on edge hardware (like a Raspberry Pi) via `llama.cpp` while retaining the intelligence to understand complex human intent. + +## 📦 Quantized Versions (GGUF) +For high-performance inference , use these GGUF quants: + +* **[TASX-Cmd-0.5B-GGUF (mradermacher)](https://huggingface.co/mradermacher/TASX-Cmd-0.5B-GGUF)** — *Includes high-quality iMatrix and IQ quants.* +* **[TASX-Cmd-0.5B-Q8_0 (ReXeeD)](https://huggingface.co/ReXeeD/TASX-Cmd-0.5B-GGUF)** — *Standard high-precision 8-bit quantization.* + +## 🌟 Key Features +* **Strict JSON Output:** Never outputs conversational filler; only valid JSON arrays. +* **Typo & Slang Immunity:** Successfully maps messy speech (e.g., "scoot forward lik 3 point 5 meeters") to perfect floats and commands. +* **Dynamic Location Extraction:** Converts any spoken room or location name (e.g., "Professor Xavier's Office") into clean `snake_case` (e.g., `professor_xavier_office`). +* **Physical Constraint Logic:** Automatically generates implicit macro sequences (like `sit` -> `stand` -> `move`) for fetching and delivering items without needing explicit user instruction. + +--- + +## 🛠️ Supported Actions & Commands + +The model is trained to strictly output one or more of the following 20 commands formatted as a JSON array of `actions`. + +### 1. Teleop (Movement & Speed) +* `{"type": "teleop", "cmd": "move_forward", "distance": }` +* `{"type": "teleop", "cmd": "move_backward", "distance": }` +* `{"type": "teleop", "cmd": "rotate_left", "angle": }` +* `{"type": "teleop", "cmd": "rotate_right", "angle": }` +* `{"type": "teleop", "cmd": "set_speed", "level": "slow" | "normal" | "fast"}` +* `{"type": "teleop", "cmd": "stop"}` *(For casual pauses)* +* `{"type": "teleop", "cmd": "e_stop"}` *(For panicked/emergency stops)* + +### 2. Nav2 (Autonomous Navigation) +* `{"type": "nav2", "cmd": "go_to_waypoint", "target": ""}` +* `{"type": "nav2", "cmd": "cancel_goal"}` + +### 3. Stunts (Posture & Tricks) +* `{"type": "stunt", "cmd": "full_sit"}` +* `{"type": "stunt", "cmd": "half_sit"}` +* `{"type": "stunt", "cmd": "stand_up"}` +* `{"type": "stunt", "cmd": "spin", "direction": "clockwise" | "anticlockwise"}` + +--- + +## 🧠 Advanced Behaviors (Macros) + +TASX-Command-0.5B has been taught physical robotics logic. It knows a robot cannot drive while sitting. + +If you ask it to perform a delivery (e.g., *"Fetch my laptop from the server room and bring it to John's desk"*), it will automatically output the required posture macros: +```json +{ + "actions": [ + {"type": "nav2", "cmd": "go_to_waypoint", "target": "server_room"}, + {"type": "stunt", "cmd": "full_sit"}, + {"type": "stunt", "cmd": "stand_up"}, + {"type": "nav2", "cmd": "go_to_waypoint", "target": "john_desk"}, + {"type": "stunt", "cmd": "full_sit"} + ] +} + +``` +## TEST SCRIPT +``` +# ============================================================ +# ============================================================ +from unsloth import FastLanguageModel +import torch + +MODEL_PATH = "./tasx_sft_merged" +MAX_SEQ_LENGTH = 512 + +print("⏳ Loading your fine-tuned TASX model...") +model, tokenizer = FastLanguageModel.from_pretrained( + model_name = MODEL_PATH, + max_seq_length = MAX_SEQ_LENGTH, + dtype = torch.float16, + load_in_4bit = False, +) + +FastLanguageModel.for_inference(model) + +print("\n" + "="*50) +print("TASX ROBOT COMMAND TESTER READY") +print("Type a command in the box below and press Enter.") +print("Type 'quit' or 'q' to stop.") +print("="*50 + "\n") + + +while True: + user_text = input("🎤 You: ") + + if user_text.lower() in ['quit', 'exit', 'q']: + print("Stopping inference. Great job!") + break + + if not user_text.strip(): + continue + + + prompt = f"<|im_start|>user\n{user_text}<|im_end|>\n<|im_start|>assistant\n" + + + inputs = tokenizer([prompt], return_tensors="pt").to("cuda") + + # Generate the output + outputs = model.generate( + **inputs, + max_new_tokens=150, + use_cache=True, + temperature=0.1, + do_sample=True, + ) + + # Decode the output (slice off the prompt so we only see the assistant's new text) + response = tokenizer.batch_decode( + outputs[:, inputs.input_ids.shape[1]:], + skip_special_tokens=True + )[0] + + print(f"TASX: {response.strip()}\n") +``` +## Contact +Need a custom version of this model for your specific robot's API or hardware? Contact: [albinthomas7034@gmail.com] \ No newline at end of file diff --git a/chat_template.jinja b/chat_template.jinja new file mode 100644 index 0000000..bdf7919 --- /dev/null +++ b/chat_template.jinja @@ -0,0 +1,54 @@ +{%- if tools %} + {{- '<|im_start|>system\n' }} + {%- if messages[0]['role'] == 'system' %} + {{- messages[0]['content'] }} + {%- else %} + {{- 'You are Qwen, created by Alibaba Cloud. You are a helpful assistant.' }} + {%- endif %} + {{- "\n\n# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within XML tags:\n" }} + {%- for tool in tools %} + {{- "\n" }} + {{- tool | tojson }} + {%- endfor %} + {{- "\n\n\nFor each function call, return a json object with function name and arguments within XML tags:\n\n{\"name\": , \"arguments\": }\n<|im_end|>\n" }} +{%- else %} + {%- if messages[0]['role'] == 'system' %} + {{- '<|im_start|>system\n' + messages[0]['content'] + '<|im_end|>\n' }} + {%- else %} + {{- '<|im_start|>system\nYou are Qwen, created by Alibaba Cloud. You are a helpful assistant.<|im_end|>\n' }} + {%- endif %} +{%- endif %} +{%- for message in messages %} + {%- if (message.role == "user") or (message.role == "system" and not loop.first) or (message.role == "assistant" and not message.tool_calls) %} + {{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }} + {%- elif message.role == "assistant" %} + {{- '<|im_start|>' + message.role }} + {%- if message.content %} + {{- '\n' + message.content }} + {%- endif %} + {%- for tool_call in message.tool_calls %} + {%- if tool_call.function is defined %} + {%- set tool_call = tool_call.function %} + {%- endif %} + {{- '\n\n{"name": "' }} + {{- tool_call.name }} + {{- '", "arguments": ' }} + {{- tool_call.arguments | tojson }} + {{- '}\n' }} + {%- endfor %} + {{- '<|im_end|>\n' }} + {%- elif message.role == "tool" %} + {%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != "tool") %} + {{- '<|im_start|>user' }} + {%- endif %} + {{- '\n\n' }} + {{- message.content }} + {{- '\n' }} + {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %} + {{- '<|im_end|>\n' }} + {%- endif %} + {%- endif %} +{%- endfor %} +{%- if add_generation_prompt %} + {{- '<|im_start|>assistant\n' }} +{%- endif %} diff --git a/config.json b/config.json new file mode 100644 index 0000000..661bff1 --- /dev/null +++ b/config.json @@ -0,0 +1,58 @@ +{ + "architectures": [ + "Qwen2ForCausalLM" + ], + "attention_dropout": 0.0, + "bos_token_id": null, + "torch_dtype": "float16", + "eos_token_id": 151645, + "hidden_act": "silu", + "hidden_size": 896, + "initializer_range": 0.02, + "intermediate_size": 4864, + "layer_types": [ + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention" + ], + "max_position_embeddings": 32768, + "max_window_layers": 21, + "model_type": "qwen2", + "num_attention_heads": 14, + "num_hidden_layers": 24, + "num_key_value_heads": 2, + "pad_token_id": 151665, + "rms_norm_eps": 1e-06, + "rope_parameters": { + "rope_theta": 1000000.0, + "rope_type": "default" + }, + "sliding_window": null, + "tie_word_embeddings": true, + "unsloth_fixed": true, + "unsloth_version": "2026.4.8", + "use_cache": false, + "use_sliding_window": false, + "vocab_size": 151936 +} \ No newline at end of file diff --git a/model.safetensors b/model.safetensors new file mode 100644 index 0000000..5a44418 --- /dev/null +++ b/model.safetensors @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cd04da20b2ae7cacf65fe58b1db4a102b7c1dded1cb5f66ade00cd175619828d +size 988097824 diff --git a/tokenizer.json b/tokenizer.json new file mode 100644 index 0000000..5340d81 --- /dev/null +++ b/tokenizer.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bd5948af71b4f56cf697f7580814c7ce8b80595ef985544efcacf716126a2e31 +size 11422356 diff --git a/tokenizer_config.json b/tokenizer_config.json new file mode 100644 index 0000000..5bd98d7 --- /dev/null +++ b/tokenizer_config.json @@ -0,0 +1,201 @@ +{ + "add_prefix_space": false, + "backend": "tokenizers", + "bos_token": null, + "clean_up_tokenization_spaces": false, + "eos_token": "<|im_end|>", + "errors": "replace", + "is_local": true, + "model_max_length": 32768, + "pad_token": "<|PAD_TOKEN|>", + "padding_side": "left", + "split_special_tokens": false, + "tokenizer_class": "Qwen2Tokenizer", + "unk_token": null, + "added_tokens_decoder": { + "151643": { + "content": "<|endoftext|>", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false, + "special": true + }, + "151644": { + "content": "<|im_start|>", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false, + "special": true + }, + "151645": { + "content": "<|im_end|>", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false, + "special": true + }, + "151646": { + "content": "<|object_ref_start|>", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false, + "special": true + }, + "151647": { + "content": "<|object_ref_end|>", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false, + "special": true + }, + "151648": { + "content": "<|box_start|>", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false, + "special": true + }, + "151649": { + "content": "<|box_end|>", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false, + "special": true + }, + "151650": { + "content": "<|quad_start|>", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false, + "special": true + }, + "151651": { + "content": "<|quad_end|>", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false, + "special": true + }, + "151652": { + "content": "<|vision_start|>", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false, + "special": true + }, + "151653": { + "content": "<|vision_end|>", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false, + "special": true + }, + "151654": { + "content": "<|vision_pad|>", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false, + "special": true + }, + "151655": { + "content": "<|image_pad|>", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false, + "special": true + }, + "151656": { + "content": "<|video_pad|>", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false, + "special": true + }, + "151657": { + "content": "", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false, + "special": false + }, + "151658": { + "content": "", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false, + "special": false + }, + "151659": { + "content": "<|fim_prefix|>", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false, + "special": false + }, + "151660": { + "content": "<|fim_middle|>", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false, + "special": false + }, + "151661": { + "content": "<|fim_suffix|>", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false, + "special": false + }, + "151662": { + "content": "<|fim_pad|>", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false, + "special": false + }, + "151663": { + "content": "<|repo_name|>", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false, + "special": false + }, + "151664": { + "content": "<|file_sep|>", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false, + "special": false + }, + "151665": { + "content": "<|PAD_TOKEN|>", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false, + "special": true + } + } +}