Image-Text-to-Text
Transformers
Safetensors
glm5_next
abliterated
uncensored
glm
glm-5.3
glm-5.3-flash
Mixture of Experts
exl3
tr3
quantization
reasoning
conversational
4-bit precision
Instructions to use lovesenko/GLM-5.3-Flash-tr3-4bpw-Abliterated with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use lovesenko/GLM-5.3-Flash-tr3-4bpw-Abliterated with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="lovesenko/GLM-5.3-Flash-tr3-4bpw-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("lovesenko/GLM-5.3-Flash-tr3-4bpw-Abliterated") model = AutoModelForMultimodalLM.from_pretrained("lovesenko/GLM-5.3-Flash-tr3-4bpw-Abliterated", device_map="auto") 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 lovesenko/GLM-5.3-Flash-tr3-4bpw-Abliterated with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "lovesenko/GLM-5.3-Flash-tr3-4bpw-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": "lovesenko/GLM-5.3-Flash-tr3-4bpw-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/lovesenko/GLM-5.3-Flash-tr3-4bpw-Abliterated
- SGLang
How to use lovesenko/GLM-5.3-Flash-tr3-4bpw-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 "lovesenko/GLM-5.3-Flash-tr3-4bpw-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": "lovesenko/GLM-5.3-Flash-tr3-4bpw-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 "lovesenko/GLM-5.3-Flash-tr3-4bpw-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": "lovesenko/GLM-5.3-Flash-tr3-4bpw-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 lovesenko/GLM-5.3-Flash-tr3-4bpw-Abliterated with Docker Model Runner:
docker model run hf.co/lovesenko/GLM-5.3-Flash-tr3-4bpw-Abliterated
| #!/usr/bin/env python3 | |
| """Run text generation with the selective packed GLM-5.3 K4/TP2 or K6/TP4 runtime.""" | |
| from __future__ import annotations | |
| import argparse | |
| import json | |
| import os | |
| from pathlib import Path | |
| from quant_pipeline.runtime.glm53_tp2_exl3 import ( | |
| packed_runtime_census, | |
| patch_transformers, | |
| target_tp_size_for_bits, | |
| ) | |
| def main() -> int: | |
| parser = argparse.ArgumentParser(description=__doc__) | |
| parser.add_argument("--model", type=Path, required=True) | |
| parser.add_argument("--exllamav3-source", type=Path, required=True) | |
| parser.add_argument("--prompt", required=True) | |
| parser.add_argument("--max-new-tokens", type=int, default=128) | |
| parser.add_argument("--attention-backend", choices=("eager", "sdpa"), default="eager") | |
| args = parser.parse_args() | |
| if args.max_new_tokens < 1: | |
| raise ValueError("max-new-tokens must be positive") | |
| try: | |
| rank = int(os.environ["RANK"]) | |
| local_rank = int(os.environ["LOCAL_RANK"]) | |
| world_size = int(os.environ["WORLD_SIZE"]) | |
| except (KeyError, ValueError) as error: | |
| raise RuntimeError("launch with torchrun --nproc-per-node=2 for K4 or 4 for K6") from error | |
| config = json.loads((args.model / "config.json").read_text(encoding="utf-8")) | |
| bits = int(config.get("quantization_config", {}).get("bits", 0)) | |
| expected_tp = target_tp_size_for_bits(bits) | |
| if world_size != expected_tp or rank not in range(world_size) or local_rank not in range(world_size): | |
| raise RuntimeError(f"packed K{bits} requires exactly TP{expected_tp}") | |
| patch_transformers(exllamav3_source=args.exllamav3_source) | |
| import torch | |
| import torch.distributed as dist | |
| from transformers import AutoTokenizer, Glm5NextForConditionalGeneration | |
| from transformers.distributed import DistributedConfig | |
| torch.cuda.set_device(local_rank) | |
| if not dist.is_initialized(): | |
| dist.init_process_group("nccl") | |
| tokenizer = AutoTokenizer.from_pretrained(args.model, local_files_only=True) | |
| model = Glm5NextForConditionalGeneration.from_pretrained( | |
| args.model, | |
| dtype=torch.bfloat16, | |
| distributed_config=DistributedConfig( | |
| tp_size=world_size, tp_plan="auto", enable_expert_parallel=False | |
| ), | |
| attn_implementation=args.attention_backend, | |
| local_files_only=True, | |
| ).eval() | |
| census = packed_runtime_census(model) | |
| encoded = tokenizer(args.prompt, return_tensors="pt") | |
| encoded = {name: value.to(torch.device("cuda", local_rank)) for name, value in encoded.items()} | |
| with torch.inference_mode(): | |
| generated = model.generate( | |
| **encoded, | |
| do_sample=False, | |
| max_new_tokens=args.max_new_tokens, | |
| ) | |
| if rank == 0: | |
| print( | |
| json.dumps( | |
| { | |
| "bits": bits, | |
| "tp_size": world_size, | |
| "packed_matrix_count": census["packed_matrix_count"], | |
| "text": tokenizer.decode(generated[0], skip_special_tokens=True), | |
| }, | |
| ensure_ascii=False, | |
| ) | |
| ) | |
| dist.barrier() | |
| dist.destroy_process_group() | |
| return 0 | |
| if __name__ == "__main__": | |
| raise SystemExit(main()) | |