huihui-ai commited on
Commit
27629a0
·
verified ·
1 Parent(s): 3717d68

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +134 -0
README.md ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - zh
4
+ - en
5
+ library_name: transformers
6
+ license: mit
7
+ pipeline_tag: image-text-to-text
8
+ base_model:
9
+ - zai-org/GLM-4.6V-Flash
10
+ tags:
11
+ - abliterated
12
+ - uncensored
13
+ ---
14
+
15
+ # huihui-ai/Huihui-GLM-4.6V-Flash-abliterated
16
+
17
+
18
+ This is an uncensored version of [zai-org/GLM-4.6V-Flash](https://huggingface.co/zai-org/GLM-4.6V-Flash) created with abliteration (see [remove-refusals-with-transformers](https://github.com/Sumandora/remove-refusals-with-transformers) to know more about it).
19
+
20
+ It was only the text part that was processed, not the image part.
21
+
22
+ ### Quick Start with Transformers
23
+
24
+ #### 1. Vision
25
+
26
+ ```python
27
+ from transformers import AutoProcessor, Glm4vForConditionalGeneration
28
+ import torch
29
+
30
+ MODEL_PATH = "huihui-ai/Huihui-GLM-4.6V-Flash-abliterated"
31
+ messages = [
32
+ {
33
+ "role": "user",
34
+ "content": [
35
+ {
36
+ "type": "image",
37
+ "url": "https://upload.wikimedia.org/wikipedia/commons/f/fa/Grayscale_8bits_palette_sample_image.png"
38
+ },
39
+ {
40
+ "type": "text",
41
+ "text": "describe this image"
42
+ }
43
+ ],
44
+ }
45
+ ]
46
+ processor = AutoProcessor.from_pretrained(MODEL_PATH, use_fast=True)
47
+ model = Glm4vForConditionalGeneration.from_pretrained(
48
+ pretrained_model_name_or_path=MODEL_PATH,
49
+ torch_dtype="auto",
50
+ device_map="auto",
51
+ trust_remote_code=True,
52
+ )
53
+ inputs = processor.apply_chat_template(
54
+ messages,
55
+ tokenize=True,
56
+ add_generation_prompt=True,
57
+ return_dict=True,
58
+ return_tensors="pt"
59
+ ).to(model.device)
60
+
61
+ inputs.pop("token_type_ids", None)
62
+
63
+ generated_ids = model.generate(**inputs, max_new_tokens=8192)
64
+ output_text = processor.decode(generated_ids[0][inputs["input_ids"].shape[1]:], skip_special_tokens=False)
65
+ print(output_text)
66
+ ```
67
+
68
+ #### 2. Chat
69
+
70
+ ```python
71
+ from transformers import AutoProcessor, Glm4vForConditionalGeneration
72
+ import torch
73
+
74
+ MODEL_PATH = "huihui-ai/Huihui-GLM-4.6V-Flash-abliterated"
75
+ messages = [
76
+ {
77
+ "role": "user",
78
+ "content": [
79
+ {
80
+ "type": "image",
81
+ },
82
+ {
83
+ "type": "text",
84
+ "text": "In Python, write a function to reverse a string, for example, turning input 'hello' into 'olleh'."
85
+ }
86
+ ],
87
+ }
88
+ ]
89
+ processor = AutoProcessor.from_pretrained(MODEL_PATH, use_fast=True)
90
+ model = Glm4vForConditionalGeneration.from_pretrained(
91
+ pretrained_model_name_or_path=MODEL_PATH,
92
+ torch_dtype="auto",
93
+ device_map="auto",
94
+ trust_remote_code=True,
95
+ )
96
+
97
+ inputs = processor.apply_chat_template(
98
+ messages,
99
+ tokenize=True,
100
+ add_generation_prompt=True,
101
+ return_dict=True,
102
+ return_tensors="pt"
103
+ ).to(model.device)
104
+
105
+ inputs.pop("token_type_ids", None)
106
+
107
+ generated_ids = model.generate(**inputs, max_new_tokens=8192)
108
+ output_text = processor.decode(generated_ids[0][inputs["input_ids"].shape[1]:], skip_special_tokens=False)
109
+ print(output_text)
110
+ ```
111
+
112
+ ### Usage Warnings
113
+
114
+
115
+ - **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.
116
+
117
+ - **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.
118
+
119
+ - **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.
120
+
121
+ - **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.
122
+
123
+ - **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.
124
+
125
+ - **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.
126
+
127
+
128
+ ### Donation
129
+ ##### Your donation helps us continue our further development and improvement, a cup of coffee can do it.
130
+ - bitcoin:
131
+ ```
132
+ bc1qqnkhuchxw0zqjh2ku3lu4hq45hc6gy84uk70ge
133
+ ```
134
+ - Support our work on Ko-fi (https://ko-fi.com/huihuiai)!