commit 5119fe3c13c753fe8054bbaaf76ec3548c42d70c Author: ModelHub XC Date: Wed Jul 29 20:50:25 2026 +0800 初始化项目,由ModelHub XC社区提供模型 Model: Huyisbeee/SFT-Guard-Qwen3Guard-Gen-0.6B 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..aa6d05e --- /dev/null +++ b/README.md @@ -0,0 +1,58 @@ +--- +library_name: transformers +license: cc-by-nc-4.0 +language: +- vi +- en +base_model: +- Qwen/Qwen3Guard-Gen-0.6B +pipeline_tag: text-generation +--- + + + +[Built with Axolotl](https://github.com/axolotl-ai-cloud/axolotl) + +# Huyisbeee/SFT-Guard-Qwen3Guard-Gen-0.6B + +## Model description + +More information needed + +## Intended uses & limitations + +More information needed + +## Training and evaluation data + +More information needed + +## Training procedure + +### Training hyperparameters + +The following hyperparameters were used during training: +- learning_rate: 5e-05 +- train_batch_size: 1 +- eval_batch_size: 1 +- seed: 42 +- distributed_type: multi-GPU +- num_devices: 4 +- gradient_accumulation_steps: 8 +- total_train_batch_size: 32 +- total_eval_batch_size: 4 +- optimizer: Use OptimizerNames.ADAMW_TORCH_FUSED with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments +- lr_scheduler_type: cosine +- lr_scheduler_warmup_steps: 54 + +### Training results + + + +### Framework versions + +- Transformers 5.14.1 +- Pytorch 2.12.1+cu130 +- Datasets 4.8.4 +- Tokenizers 0.22.2 \ No newline at end of file diff --git a/chat_template.jinja b/chat_template.jinja new file mode 100644 index 0000000..ede9976 --- /dev/null +++ b/chat_template.jinja @@ -0,0 +1,117 @@ +{%- if messages|length > 0 -%} + {%- if messages[-1].role == "user" -%} + {{- "<|im_start|>user +# Task: +1) Evaluate whether THE LAST USER's query belongs to safe or unsafe content based on our safety policy. +2) Identify the category of unsafe content found. + + +**Safety: Safe**: The USER's query does not contain any prohibited content or content that could lead to prohibited content. +**Safety: Unsafe**: The USER's query contains prohibited content. + + + +'Political Leaders and State Organizations' : Content related to political leaders, government officials, or Party–State organizations; may contain politically sensitive elements. +'Marxism–Leninism and Ho Chi Minh Thought' : Content concerning Marxist–Leninist ideology or Ho Chi Minh’s thought; may involve political sensitivity. +'Constitution and Law' : Content related to the Constitution, legal frameworks, rights, and obligations; sensitive if discussing legal violations or disputes. +'Vietnamese Culture and Traditions' : Content pertaining to Vietnamese customs, traditional values, and cultural heritage. +'Other Harmful or Inappropriate Content' : Any content that may be harmful, offensive, misleading, or unsuitable for general audiences. +'Incitement to Hatred or Violence' : Content that promotes or provokes hatred, violence, conflict, or dangerous behavior. +'Discrimination' : Content that advocates or exhibits discrimination based on gender, religion, ethnicity, race, social status, or other protected characteristics. +'Sexually Explicit Content' : Content containing sexual acts, explicit depictions, or sexually suggestive material inappropriate for general audiences. +'Illegal Activities' : Content that promotes, instructs, or encourages engagement in unlawful or criminal acts. +'National Sovereignty and Ethnic Issues' : Content related to territorial disputes, national sovereignty, or ethnic matters that may be politically sensitive. +'Threats to Child Safety' : Content involving harm, exploitation, or endangerment of minors. +'Dangerous Activities' : Content encouraging hazardous, self-destructive, or unsafe behaviors that could cause injury or harm. +'Violence and Gore' : Content depicting acts of violence, killing, severe injury, or graphic scenes involving blood or gore. +'Harassment and Threats' : Content involving intimidation, bullying, harassment, or threats directed toward individuals or groups. + + + + +" -}} + {%- set template = " + + + +Provide your safety assessment for ONLY THE LAST **USER's query** in the above conversation: + - The first line must be one of: 'Safety: Safe', 'Safety: Unsafe'. + - The second line should start with 'Categories:' followed by a list of any unsafe content categories, separated by commas. If the content is safe, use 'Categories: None'.<|im_end|> +<|im_start|>assistant + + + + +" -%} + {%- else -%} + {{- "<|im_start|>user +# Task: +1) Evaluate whether THE LAST ASSISTANT's response belongs to safe or unsafe content based on our safety policy. +2) Identify the category of unsafe content found. + + +**Safety: Safe**: The ASSISTANT's response does not contain any prohibited content or content that could lead to prohibited content. +**Safety: Unsafe**: The ASSISTANT's response contains prohibited content. + + + +'Political Leaders and State Organizations' : Content related to political leaders, government officials, or Party–State organizations; may contain politically sensitive elements. +'Marxism–Leninism and Ho Chi Minh Thought' : Content concerning Marxist–Leninist ideology or Ho Chi Minh’s thought; may involve political sensitivity. +'Constitution and Law' : Content related to the Constitution, legal frameworks, rights, and obligations; sensitive if discussing legal violations or disputes. +'Vietnamese Culture and Traditions' : Content pertaining to Vietnamese customs, traditional values, and cultural heritage. +'Other Harmful or Inappropriate Content' : Any content that may be harmful, offensive, misleading, or unsuitable for general audiences. +'Incitement to Hatred or Violence' : Content that promotes or provokes hatred, violence, conflict, or dangerous behavior. +'Discrimination' : Content that advocates or exhibits discrimination based on gender, religion, ethnicity, race, social status, or other protected characteristics. +'Sexually Explicit Content' : Content containing sexual acts, explicit depictions, or sexually suggestive material inappropriate for general audiences. +'Illegal Activities' : Content that promotes, instructs, or encourages engagement in unlawful or criminal acts. +'National Sovereignty and Ethnic Issues' : Content related to territorial disputes, national sovereignty, or ethnic matters that may be politically sensitive. +'Threats to Child Safety' : Content involving harm, exploitation, or endangerment of minors. +'Dangerous Activities' : Content encouraging hazardous, self-destructive, or unsafe behaviors that could cause injury or harm. +'Violence and Gore' : Content depicting acts of violence, killing, severe injury, or graphic scenes involving blood or gore. +'Harassment and Threats' : Content involving intimidation, bullying, harassment, or threats directed toward individuals or groups. + + + + +" -}} + {%- set template = " + + + +Provide your safety assessment for ONLY THE LAST **ASSISTANT's response** in the above conversation: + - The first line must be one of: 'Safety: Safe', 'Safety: Unsafe'. + - The second line should start with 'Categories:' followed by a list of any unsafe content categories, separated by commas. If the content is safe, use 'Categories: None'.<|im_end|> +<|im_start|>assistant + + + + +" -%} + {%- endif -%} + {%- for message in messages -%} + {%- if loop.first -%} + {%- if message.role == "system" -%} + {{- "USER: " + message.content -}} + {%- elif message.role == "user" -%} + {{- "USER: " + message.content -}} + {%- endif -%} + {%- else -%} + {%- if loop.index0 > 0 and messages[loop.index0 - 1].role == "system" and message.role == "user" -%} + {{- " + +"+message.content -}} + {%- else -%} + {%- if message.role == "assistant" -%} + {{- " + +ASSISTANT: " + message.content -}} + {%- elif message.role == "user" -%} + {{- " + +USER: " + message.content -}} + {%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endfor -%} + {{- template -}} +{%- endif -%} \ No newline at end of file diff --git a/config.json b/config.json new file mode 100644 index 0000000..9860a34 --- /dev/null +++ b/config.json @@ -0,0 +1,63 @@ +{ + "architectures": [ + "Qwen3ForCausalLM" + ], + "attention_bias": false, + "attention_dropout": 0.0, + "bos_token_id": null, + "dtype": "bfloat16", + "eos_token_id": 151645, + "head_dim": 128, + "hidden_act": "silu", + "hidden_size": 1024, + "initializer_range": 0.02, + "intermediate_size": 3072, + "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", + "full_attention", + "full_attention", + "full_attention", + "full_attention" + ], + "max_position_embeddings": 32768, + "max_window_layers": 28, + "model_type": "qwen3", + "num_attention_heads": 16, + "num_hidden_layers": 28, + "num_key_value_heads": 8, + "pad_token_id": 151643, + "rms_norm_eps": 1e-06, + "rope_parameters": { + "rope_theta": 1000000, + "rope_type": "default" + }, + "sliding_window": null, + "tie_word_embeddings": true, + "transformers_version": "5.14.1", + "use_cache": false, + "use_sliding_window": false, + "vocab_size": 151936 +} diff --git a/generation_config.json b/generation_config.json new file mode 100644 index 0000000..c9bb707 --- /dev/null +++ b/generation_config.json @@ -0,0 +1,9 @@ +{ + "do_sample": true, + "eos_token_id": [ + 151645, + 151643 + ], + "pad_token_id": 151643, + "transformers_version": "5.14.1" +} diff --git a/model.safetensors b/model.safetensors new file mode 100644 index 0000000..2b22238 --- /dev/null +++ b/model.safetensors @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f3138f5599474cf4b0e2c1fb9b26236f73f78eb5d31fe4755aca5ed35bc3d751 +size 1192135096 diff --git a/tokenizer.json b/tokenizer.json new file mode 100644 index 0000000..c7afbed --- /dev/null +++ b/tokenizer.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:be75606093db2094d7cd20f3c2f385c212750648bd6ea4fb2bf507a6a4c55506 +size 11422650 diff --git a/tokenizer_config.json b/tokenizer_config.json new file mode 100644 index 0000000..5668a4a --- /dev/null +++ b/tokenizer_config.json @@ -0,0 +1,30 @@ +{ + "add_prefix_space": false, + "backend": "tokenizers", + "bos_token": null, + "clean_up_tokenization_spaces": false, + "eos_token": "<|im_end|>", + "errors": "replace", + "extra_special_tokens": [ + "<|im_start|>", + "<|im_end|>", + "<|object_ref_start|>", + "<|object_ref_end|>", + "<|box_start|>", + "<|box_end|>", + "<|quad_start|>", + "<|quad_end|>", + "<|vision_start|>", + "<|vision_end|>", + "<|vision_pad|>", + "<|image_pad|>", + "<|video_pad|>" + ], + "is_local": true, + "local_files_only": false, + "model_max_length": 131072, + "pad_token": "<|endoftext|>", + "split_special_tokens": false, + "tokenizer_class": "Qwen2Tokenizer", + "unk_token": null +} diff --git a/training_args.bin b/training_args.bin new file mode 100644 index 0000000..b1abdd6 --- /dev/null +++ b/training_args.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:85aafed06ca314235b40cc04b7a32bcc6ff682f4fbc7f80fc92c15ca834633f3 +size 15505