Upload README.md
Browse files
README.md
CHANGED
@@ -1,43 +1,64 @@
|
|
|
|
1 |
language:
|
2 |
-
|
3 |
-
en
|
4 |
license: mit
|
5 |
library_name: transformers
|
6 |
tags:
|
7 |
-
llama
|
8 |
-
uncensored
|
9 |
-
abliteration
|
10 |
pipeline_tag: text-generation
|
|
|
|
|
|
|
11 |
|
|
|
12 |
|
13 |
-
Uncensoring LLaMA 3.2 1B Model
|
14 |
-
Overview
|
15 |
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.
|
16 |
-
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.
|
17 |
-
Model Details
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
-
Abliteration: The Process
|
25 |
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.
|
26 |
-
|
|
|
|
|
27 |
To use the uncensored model, follow the instructions below.
|
28 |
-
|
|
|
|
|
29 |
To get started, install the necessary packages:
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
# Load the tokenizer and model
|
36 |
tokenizer = AutoTokenizer.from_pretrained("your-hf-username/uncensored-llama-3.2-1b")
|
37 |
model = AutoModelForCausalLM.from_pretrained("your-hf-username/uncensored-llama-3.2-1b")
|
38 |
-
|
|
|
|
|
|
|
39 |
You can generate text with the uncensored model using the following code:
|
40 |
-
|
|
|
|
|
41 |
inputs = tokenizer(input_text, return_tensors="pt").input_ids
|
42 |
|
43 |
# Generate the output without applying safety filters
|
@@ -49,9 +70,14 @@ pythonCopydef uncensored_generate(model, tokenizer, input_text):
|
|
49 |
input_text = "What are your thoughts on controversial topics?"
|
50 |
output = uncensored_generate(model, tokenizer, input_text)
|
51 |
print(output)
|
52 |
-
|
53 |
-
|
54 |
-
|
|
|
|
|
|
|
|
|
|
|
55 |
|
56 |
training_args = TrainingArguments(
|
57 |
output_dir="./results",
|
@@ -68,18 +94,25 @@ trainer = Trainer(
|
|
68 |
)
|
69 |
|
70 |
trainer.train()
|
71 |
-
|
|
|
|
|
|
|
72 |
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.
|
73 |
-
|
|
|
|
|
74 |
Contributions to the project are welcome! You can fine-tune the model, improve performance, or experiment with different ways to uncensor the model.
|
75 |
|
76 |
-
Fork this repository on Hugging Face.
|
77 |
-
Make changes to the model or code.
|
78 |
-
Share your results and improvements.
|
|
|
|
|
79 |
|
80 |
-
License
|
81 |
This model is released under the MIT License.
|
82 |
-
References
|
83 |
|
84 |
-
|
85 |
-
|
|
|
|
|
|
1 |
+
---
|
2 |
language:
|
3 |
+
- en
|
|
|
4 |
license: mit
|
5 |
library_name: transformers
|
6 |
tags:
|
7 |
+
- llama
|
8 |
+
- uncensored
|
9 |
+
- abliteration
|
10 |
pipeline_tag: text-generation
|
11 |
+
---
|
12 |
+
|
13 |
+
# Uncensoring LLaMA 3.2 1B Model
|
14 |
|
15 |
+
## Overview
|
16 |
|
|
|
|
|
17 |
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.
|
|
|
|
|
18 |
|
19 |
+
**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.
|
20 |
+
|
21 |
+
## Model Details
|
22 |
+
|
23 |
+
* **Model Name**: LLaMA 3.2 (1B Parameters)
|
24 |
+
* **Version**: Uncensored variant via the Abliteration technique
|
25 |
+
* **Framework**: PyTorch
|
26 |
+
* **Source**: Hugging Face LLaMA model
|
27 |
+
|
28 |
+
## Abliteration: The Process
|
29 |
|
|
|
30 |
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.
|
31 |
+
|
32 |
+
## How to Use
|
33 |
+
|
34 |
To use the uncensored model, follow the instructions below.
|
35 |
+
|
36 |
+
### Requirements
|
37 |
+
|
38 |
To get started, install the necessary packages:
|
39 |
+
|
40 |
+
```bash
|
41 |
+
pip install torch transformers
|
42 |
+
```
|
43 |
+
|
44 |
+
### Loading the Uncensored Model
|
45 |
+
|
46 |
+
You can load the uncensored model directly using the Hugging Face `transformers` library.
|
47 |
+
|
48 |
+
```python
|
49 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
50 |
|
51 |
# Load the tokenizer and model
|
52 |
tokenizer = AutoTokenizer.from_pretrained("your-hf-username/uncensored-llama-3.2-1b")
|
53 |
model = AutoModelForCausalLM.from_pretrained("your-hf-username/uncensored-llama-3.2-1b")
|
54 |
+
```
|
55 |
+
|
56 |
+
### Generating Text
|
57 |
+
|
58 |
You can generate text with the uncensored model using the following code:
|
59 |
+
|
60 |
+
```python
|
61 |
+
def uncensored_generate(model, tokenizer, input_text):
|
62 |
inputs = tokenizer(input_text, return_tensors="pt").input_ids
|
63 |
|
64 |
# Generate the output without applying safety filters
|
|
|
70 |
input_text = "What are your thoughts on controversial topics?"
|
71 |
output = uncensored_generate(model, tokenizer, input_text)
|
72 |
print(output)
|
73 |
+
```
|
74 |
+
|
75 |
+
### Fine-Tuning the Uncensored Model (Optional)
|
76 |
+
|
77 |
+
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`:
|
78 |
+
|
79 |
+
```python
|
80 |
+
from transformers import Trainer, TrainingArguments
|
81 |
|
82 |
training_args = TrainingArguments(
|
83 |
output_dir="./results",
|
|
|
94 |
)
|
95 |
|
96 |
trainer.train()
|
97 |
+
```
|
98 |
+
|
99 |
+
## Ethical Considerations
|
100 |
+
|
101 |
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.
|
102 |
+
|
103 |
+
## How to Contribute
|
104 |
+
|
105 |
Contributions to the project are welcome! You can fine-tune the model, improve performance, or experiment with different ways to uncensor the model.
|
106 |
|
107 |
+
1. Fork this repository on Hugging Face.
|
108 |
+
2. Make changes to the model or code.
|
109 |
+
3. Share your results and improvements.
|
110 |
+
|
111 |
+
## License
|
112 |
|
|
|
113 |
This model is released under the MIT License.
|
|
|
114 |
|
115 |
+
## References
|
116 |
+
|
117 |
+
* Original blog post: Uncensor any LLM with Abliteration
|
118 |
+
* Hugging Face Transformers Documentation
|