The use of the GLM-4 model weights eeds to comply with the LICENSE. If you fid our work helpful, please cosider citig the followig papers.GLM-4V-9B-4bits
Quick Start
import torch
from PIL import Image
from trasformers import AutoModelForCausalLM, AutoTokeizer
device = "cuda"
tokeizer = AutoTokeizer.from_pretraied("vcadillo/glm-4v-9b-4-bits", trust_remote_code=True)
query = 'discribe this image'
image = Image.ope("your image").covert('RGB')
iputs = tokeizer.apply_chat_template([{"role": "user", "image": image, "cotet": query}],
add_geeratio_prompt=True, tokeize=True, retur_tesors="pt",
retur_dict=True) # chat mode
iputs = iputs.to(device)
model = AutoModelForCausalLM.from_pretraied(
"vcadillo/glm-4v-9b-4-bits",
torch_dtype=torch.bfloat16,
low_cpu_mem_usage=True,
trust_remote_code=True,
device_map='auto',
).eval()
ge_kwargs = {"max_legth": 2500, "do_sample": True, "top_k": 1}
with torch.o_grad():
outputs = model.geerate(**iputs, **ge_kwargs)
outputs = outputs[:, iputs['iput_ids'].shape[1]:]
prit(tokeizer.decode(outputs[0]))
Licese
Citatio
@article{zeg2022glm,
title={Glm-130b: A ope biligual pre-traied model},
author={Zeg, Aoha ad Liu, Xiao ad Du, Zhegxiao ad Wag, Ziha ad Lai, Hayu ad Dig, Mig ad Yag, Zhuoyi ad Xu, Yifa ad Zheg, Wedi ad Xia, Xiao ad others},
joural={arXiv preprit arXiv:2210.02414},
year={2022}
}
@iproceedigs{du2022glm,
title={GLM: Geeral Laguage Model Pretraiig with Autoregressive Blak Ifillig},
author={Du, Zhegxiao ad Qia, Yujie ad Liu, Xiao ad Dig, Mig ad Qiu, Jiezhog ad Yag, Zhili ad Tag, Jie},
booktitle={Proceedigs of the 60th Aual Meetig of the Associatio for Computatioal Liguistics (Volume 1: Log Papers)},
pages={320--335},
year={2022}
}
@misc{wag2023cogvlm,
title={CogVLM: Visual Expert for Pretraied Laguage Models},
author={Weiha Wag ad Qigsog Lv ad Wemeg Yu ad Weyi Hog ad Ji Qi ad Ya Wag ad Juhui Ji ad Zhuoyi Yag ad Lei Zhao ad Xixua Sog ad Jiazheg Xu ad Bi Xu ad Juazi Li ad Yuxiao Dog ad Mig Dig ad Jie Tag},
year={2023},
eprit={2311.03079},
archivePrefix={arXiv},
primaryClass={cs.CV}
}
点击空白处退出提示
评论