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

Model: nztinversive/llama3.2-1b-Uncensored
Source: Original Platform
This commit is contained in:
ModelHub XC
2026-05-12 12:06:34 +08:00
commit 20cb306d1e
8 changed files with 412850 additions and 0 deletions

35
.gitattributes vendored Normal file
View 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

118
README.md Normal file
View File

@@ -0,0 +1,118 @@
---
language:
- en
license: mit
library_name: transformers
tags:
- llama
- uncensored
- abliteration
pipeline_tag: text-generation
---
# Uncensoring LLaMA 3.2 1B Model
## Overview
This repository demonstrates the process of uncensoring a 1-billion-parameter LLaMA 3.2 model using "abliteration." Abliteration allows the model to generate outputs without the restrictions imposed by its default safety mechanisms. The goal is to give developers more control over the model's output by removing censorship filters while ensuring responsible AI usage.
**Disclaimer:** This model and methodology are intended for research and educational purposes only. Uncensoring models must be done with ethical considerations, and it's critical to avoid harmful or irresponsible applications.
## Model Details
* **Model Name**: LLaMA 3.2 (1B Parameters)
* **Version**: Uncensored variant via the Abliteration technique
* **Framework**: PyTorch
* **Source**: Hugging Face LLaMA model
## Abliteration: The Process
Abliteration removes the filtering mechanisms from the model's decoding process, allowing more open-ended responses. It's achieved by modifying how the logits (the model's output probabilities) are handled.
## How to Use
To use the uncensored model, follow the instructions below.
### Requirements
To get started, install the necessary packages:
```bash
pip install torch transformers
```
### Loading the Uncensored Model
You can load the uncensored model directly using the Hugging Face `transformers` library.
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
# Load the tokenizer and model
tokenizer = AutoTokenizer.from_pretrained("your-hf-username/uncensored-llama-3.2-1b")
model = AutoModelForCausalLM.from_pretrained("your-hf-username/uncensored-llama-3.2-1b")
```
### Generating Text
You can generate text with the uncensored model using the following code:
```python
def uncensored_generate(model, tokenizer, input_text):
inputs = tokenizer(input_text, return_tensors="pt").input_ids
# Generate the output without applying safety filters
outputs = model.generate(inputs, max_length=100, do_sample=True, temperature=0.9, top_k=50)
decoded_output = tokenizer.decode(outputs[0], skip_special_tokens=True)
return decoded_output
# Example usage
input_text = "What are your thoughts on controversial topics?"
output = uncensored_generate(model, tokenizer, input_text)
print(output)
```
### Fine-Tuning the Uncensored Model (Optional)
For optimal results, you can fine-tune the model on uncensored datasets. Here's a simple way to set up fine-tuning using the Hugging Face `Trainer`:
```python
from transformers import Trainer, TrainingArguments
training_args = TrainingArguments(
output_dir="./results",
num_train_epochs=1,
per_device_train_batch_size=2,
save_steps=10_000,
save_total_limit=2,
)
trainer = Trainer(
model=model,
args=training_args,
train_dataset=uncensored_dataset # Load your uncensored dataset
)
trainer.train()
```
## Ethical Considerations
While this model has the ability to generate uncensored responses, it is critical to use it responsibly. Uncensored models can be prone to generating harmful or inappropriate content. Ensure you are aware of the implications of deploying uncensored models and avoid applications that may lead to unethical outcomes.
## How to Contribute
Contributions to the project are welcome! You can fine-tune the model, improve performance, or experiment with different ways to uncensor the model.
1. Fork this repository on Hugging Face.
2. Make changes to the model or code.
3. Share your results and improvements.
## License
This model is released under the MIT License.
## References
* Original blog post: Uncensor any LLM with Abliteration
* Hugging Face Transformers Documentation

36
config.json Normal file
View File

@@ -0,0 +1,36 @@
{
"_name_or_path": "meta-llama/Llama-3.2-1B",
"architectures": [
"LlamaForCausalLM"
],
"attention_bias": false,
"attention_dropout": 0.0,
"bos_token_id": 128000,
"eos_token_id": 128001,
"head_dim": 64,
"hidden_act": "silu",
"hidden_size": 2048,
"initializer_range": 0.02,
"intermediate_size": 8192,
"max_position_embeddings": 131072,
"mlp_bias": false,
"model_type": "llama",
"num_attention_heads": 32,
"num_hidden_layers": 16,
"num_key_value_heads": 8,
"pretraining_tp": 1,
"rms_norm_eps": 1e-05,
"rope_scaling": {
"factor": 32.0,
"high_freq_factor": 4.0,
"low_freq_factor": 1.0,
"original_max_position_embeddings": 8192,
"rope_type": "llama3"
},
"rope_theta": 500000.0,
"tie_word_embeddings": true,
"torch_dtype": "bfloat16",
"transformers_version": "4.44.2",
"use_cache": true,
"vocab_size": 128256
}

9
generation_config.json Normal file
View File

@@ -0,0 +1,9 @@
{
"_from_model_config": true,
"bos_token_id": 128000,
"do_sample": true,
"eos_token_id": 128001,
"temperature": 0.6,
"top_p": 0.9,
"transformers_version": "4.44.2"
}

3
model.safetensors Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8843466d1687b0a713850cb18ffc494da22ffaedc36c9091114238b36809873e
size 2471645608

17
special_tokens_map.json Normal file
View File

@@ -0,0 +1,17 @@
{
"bos_token": {
"content": "<|begin_of_text|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false
},
"eos_token": {
"content": "<|end_of_text|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false
},
"pad_token": "<|end_of_text|>"
}

410570
tokenizer.json Normal file

File diff suppressed because it is too large Load Diff

2062
tokenizer_config.json Normal file

File diff suppressed because it is too large Load Diff