Image-Text-to-Text
Transformers
Safetensors
Chinese
English
glm4v
abliterated
uncensored
conversational
Instructions to use huihui-ai/Huihui-GLM-4.6V-Flash-abliterated with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use huihui-ai/Huihui-GLM-4.6V-Flash-abliterated with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="huihui-ai/Huihui-GLM-4.6V-Flash-abliterated") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("huihui-ai/Huihui-GLM-4.6V-Flash-abliterated") model = AutoModelForMultimodalLM.from_pretrained("huihui-ai/Huihui-GLM-4.6V-Flash-abliterated") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use huihui-ai/Huihui-GLM-4.6V-Flash-abliterated with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "huihui-ai/Huihui-GLM-4.6V-Flash-abliterated" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "huihui-ai/Huihui-GLM-4.6V-Flash-abliterated", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/huihui-ai/Huihui-GLM-4.6V-Flash-abliterated
- SGLang
How to use huihui-ai/Huihui-GLM-4.6V-Flash-abliterated with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "huihui-ai/Huihui-GLM-4.6V-Flash-abliterated" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "huihui-ai/Huihui-GLM-4.6V-Flash-abliterated", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "huihui-ai/Huihui-GLM-4.6V-Flash-abliterated" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "huihui-ai/Huihui-GLM-4.6V-Flash-abliterated", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use huihui-ai/Huihui-GLM-4.6V-Flash-abliterated with Docker Model Runner:
docker model run hf.co/huihui-ai/Huihui-GLM-4.6V-Flash-abliterated
Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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-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)!
|