Instructions to use HUNGTZE/glm4v-sft-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use HUNGTZE/glm4v-sft-lora with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("/mnt/moe_ub/checkpoints/GLM-4.6V") model = PeftModel.from_pretrained(base_model, "HUNGTZE/glm4v-sft-lora") - Transformers
How to use HUNGTZE/glm4v-sft-lora with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="HUNGTZE/glm4v-sft-lora") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("HUNGTZE/glm4v-sft-lora", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use HUNGTZE/glm4v-sft-lora with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "HUNGTZE/glm4v-sft-lora" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "HUNGTZE/glm4v-sft-lora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/HUNGTZE/glm4v-sft-lora
- SGLang
How to use HUNGTZE/glm4v-sft-lora 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 "HUNGTZE/glm4v-sft-lora" \ --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": "HUNGTZE/glm4v-sft-lora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "HUNGTZE/glm4v-sft-lora" \ --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": "HUNGTZE/glm4v-sft-lora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use HUNGTZE/glm4v-sft-lora with Docker Model Runner:
docker model run hf.co/HUNGTZE/glm4v-sft-lora
GLM-4.6V SFT LoRA
這是基於 GLM-4.6V 108B MoE 模型進行 SFT (Supervised Fine-Tuning) 訓練的 LoRA adapter。
模型資訊
- Base Model: GLM-4.6V 108B MoE (128 experts, 8 active)
- Training Method: QLoRA (4-bit quantization + LoRA)
- LoRA Rank: 64
- LoRA Alpha: 128
- Training Steps: 600
- Max Sequence Length: 4096
訓練配置
- Hardware: 4x NVIDIA H100 80GB
- Precision: BF16
- Optimizer: AdamW
- Learning Rate: 2e-5
- Batch Size: 1 per GPU
- Gradient Accumulation: 8
使用方式
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
# 載入基礎模型
base_model = AutoModelForCausalLM.from_pretrained(
"your-base-model-path",
device_map="auto",
torch_dtype=torch.bfloat16
)
# 載入 LoRA adapter
model = PeftModel.from_pretrained(base_model, "HUNGTZE/glm4v-sft-lora")
# 載入 tokenizer
tokenizer = AutoTokenizer.from_pretrained("HUNGTZE/glm4v-sft-lora")
Framework Versions
- PEFT: 0.18.0
- Transformers: 4.x
- PyTorch: 2.x
- Downloads last month
- 1