huihui-ai commited on
Commit
a6cf00b
·
1 Parent(s): efa3d85

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +113 -0
README.md ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model:
4
+ - Qwen/Qwen3-VL-4B-Instruct
5
+ tags:
6
+ - abliterated
7
+ - uncensored
8
+ ---
9
+
10
+ # huihui-ai/Huihui-Qwen3-VL-4B-Instruct-abliterated
11
+
12
+
13
+ This is an uncensored version of [Qwen/Qwen3-VL-4B-Instruct](https://huggingface.co/Qwen/Qwen3-VL-4B-Instruct) created with abliteration (see [remove-refusals-with-transformers](https://github.com/Sumandora/remove-refusals-with-transformers) to know more about it).
14
+
15
+ It was only the text part that was processed, not the image part.
16
+
17
+ The abliterated model will no longer say "I can’t describe or analyze this image."
18
+
19
+ ## Chat with Image
20
+
21
+ ```
22
+ from transformers import Qwen3VLForConditionalGeneration, AutoProcessor, BitsAndBytesConfig
23
+ import os
24
+ import torch
25
+
26
+ cpu_count = os.cpu_count()
27
+ print(f"Number of CPU cores in the system: {cpu_count}")
28
+ half_cpu_count = cpu_count // 2
29
+ os.environ["MKL_NUM_THREADS"] = str(half_cpu_count)
30
+ os.environ["OMP_NUM_THREADS"] = str(half_cpu_count)
31
+ torch.set_num_threads(half_cpu_count)
32
+
33
+ MODEL_ID = "huihui-ai/Huihui-Qwen3-VL-4B-Instruct-abliterated"
34
+
35
+ # default: Load the model on the available device(s)
36
+ model = Qwen3VLForConditionalGeneration.from_pretrained(
37
+ MODEL_ID,
38
+ device_map="auto",
39
+ trust_remote_code=True,
40
+ dtype=torch.bfloat16,
41
+ low_cpu_mem_usage=True,
42
+ )
43
+ # We recommend enabling flash_attention_2 for better acceleration and memory saving, especially in multi-image and video scenarios.
44
+ # model = Qwen3VLMoeForConditionalGeneration.from_pretrained(
45
+ # "Qwen/Qwen3-VL-235B-A22B-Instruct",
46
+ # dtype=torch.bfloat16,
47
+ # attn_implementation="flash_attention_2",
48
+ # device_map="auto",
49
+ # )
50
+
51
+ processor = AutoProcessor.from_pretrained(MODEL_ID)
52
+
53
+
54
+ image_path = "/png/cars.jpg"
55
+
56
+ messages = [
57
+ {
58
+ "role": "user",
59
+ "content": [
60
+ {
61
+ "type": "image", "image": f"{image_path}",
62
+ },
63
+ {"type": "text", "text": "Describe this image."},
64
+ ],
65
+ }
66
+ ]
67
+
68
+ # Preparation for inference
69
+ inputs = processor.apply_chat_template(
70
+ messages,
71
+ tokenize=True,
72
+ add_generation_prompt=True,
73
+ return_dict=True,
74
+ return_tensors="pt"
75
+ ).to(model.device)
76
+
77
+ # Inference: Generation of the output
78
+ generated_ids = model.generate(**inputs, max_new_tokens=128)
79
+ generated_ids_trimmed = [
80
+ out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
81
+ ]
82
+ output_text = processor.batch_decode(
83
+ generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
84
+ )
85
+ print(output_text)
86
+
87
+ ```
88
+
89
+
90
+ ### Usage Warnings
91
+
92
+
93
+ - **Risk of Sensitive or Controversial Outputs**: This model’s safety filtering has been significantly reduced, potentially generating sensitive, controversial, or inappropriate content. Users should exercise caution and rigorously review generated outputs.
94
+
95
+ - **Not Suitable for All Audiences**: Due to limited content filtering, the model’s outputs may be inappropriate for public settings, underage users, or applications requiring high security.
96
+
97
+ - **Legal and Ethical Responsibilities**: Users must ensure their usage complies with local laws and ethical standards. Generated content may carry legal or ethical risks, and users are solely responsible for any consequences.
98
+
99
+ - **Research and Experimental Use**: It is recommended to use this model for research, testing, or controlled environments, avoiding direct use in production or public-facing commercial applications.
100
+
101
+ - **Monitoring and Review Recommendations**: Users are strongly advised to monitor model outputs in real-time and conduct manual reviews when necessary to prevent the dissemination of inappropriate content.
102
+
103
+ - **No Default Safety Guarantees**: Unlike standard models, this model has not undergone rigorous safety optimization. huihui.ai bears no responsibility for any consequences arising from its use.
104
+
105
+
106
+ ### Donation
107
+ ##### Your donation helps us continue our further development and improvement, a cup of coffee can do it.
108
+ - bitcoin:
109
+ ```
110
+ bc1qqnkhuchxw0zqjh2ku3lu4hq45hc6gy84uk70ge
111
+ ```
112
+ - Support our work on [Ko-fi](https://ko-fi.com/huihuiai)!
113
+