nikravan commited on
Commit
7087a9d
·
verified ·
1 Parent(s): c7537e6

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +48 -1
README.md CHANGED
@@ -18,4 +18,51 @@ This model is 4bit quantized of glm-4v-9b Model and fixed some error to executin
18
 
19
  It has exciting result with less then 10 Giga VRAM (Multi Modal Multi Language).
20
 
21
- you can try this model on free google colab. [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1aZGX9f5Yw1WbiOrS3TpvPk_UJUP_yYQU?usp=sharing)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
 
19
  It has exciting result with less then 10 Giga VRAM (Multi Modal Multi Language).
20
 
21
+ you can try this model on free google colab. [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1aZGX9f5Yw1WbiOrS3TpvPk_UJUP_yYQU?usp=sharing)
22
+
23
+ ### About GLM-4V-9B
24
+
25
+ GLM-4V-9B is a multimodal language model with visual understanding capabilities. The evaluation results of its related classic tasks are as follows:
26
+
27
+
28
+ | | **MMBench-EN-Test** | **MMBench-CN-Test** | **SEEDBench_IMG** | **MMStar** | **MMMU** | **MME** | **HallusionBench** | **AI2D** | **OCRBench** |
29
+ |-------------------------|---------------------|---------------------|-------------------|------------|----------|---------|--------------------|----------|--------------|
30
+ | | 英文综合 | 中文综合 | 综合能力 | 综合能力 | 学科综合 | 感知推理 | 幻觉性 | 图表理解 | 文字识别 |
31
+ | **GPT-4o, 20240513** | 83.4 | 82.1 | 77.1 | 63.9 | 69.2 | 2310.3 | 55 | 84.6 | 736 |
32
+ | **GPT-4v, 20240409** | 81 | 80.2 | 73 | 56 | 61.7 | 2070.2 | 43.9 | 78.6 | 656 |
33
+ | **GPT-4v, 20231106** | 77 | 74.4 | 72.3 | 49.7 | 53.8 | 1771.5 | 46.5 | 75.9 | 516 |
34
+ | **InternVL-Chat-V1.5** | 82.3 | 80.7 | 75.2 | 57.1 | 46.8 | 2189.6 | 47.4 | 80.6 | 720 |
35
+ | **LlaVA-Next-Yi-34B** | 81.1 | 79 | 75.7 | 51.6 | 48.8 | 2050.2 | 34.8 | 78.9 | 574 |
36
+ | **Step-1V** | 80.7 | 79.9 | 70.3 | 50 | 49.9 | 2206.4 | 48.4 | 79.2 | 625 |
37
+ | **MiniCPM-Llama3-V2.5** | 77.6 | 73.8 | 72.3 | 51.8 | 45.8 | 2024.6 | 42.4 | 78.4 | 725 |
38
+ | **Qwen-VL-Max** | 77.6 | 75.7 | 72.7 | 49.5 | 52 | 2281.7 | 41.2 | 75.7 | 684 |
39
+ | **GeminiProVision** | 73.6 | 74.3 | 70.7 | 38.6 | 49 | 2148.9 | 45.7 | 72.9 | 680 |
40
+ | **Claude-3V Opus** | 63.3 | 59.2 | 64 | 45.7 | 54.9 | 1586.8 | 37.8 | 70.6 | 694 |
41
+ | **GLM-4v-9B** | 81.1 | 79.4 | 76.8 | 58.7 | 47.2 | 2163.8 | 46.6 | 81.1 | 786 |
42
+ **This repository is the model repository of GLM-4V-9B, supporting `8K` context length.**
43
+ ## Quick Start
44
+ Welcome to visit our [github](https://github.com/THUDM/GLM-4) to view more execution codes.
45
+ ```python
46
+ import torch
47
+ from PIL import Image
48
+ from transformers import AutoModelForCausalLM, AutoTokenizer
49
+ device = "cuda"
50
+ tokenizer = AutoTokenizer.from_pretrained("THUDM/glm-4v-9b", trust_remote_code=True)
51
+ query = 'discribe this image'
52
+ image = Image.open("your image").convert('RGB')
53
+ inputs = tokenizer.apply_chat_template([{"role": "user", "image": image, "content": query}],
54
+ add_generation_prompt=True, tokenize=True, return_tensors="pt",
55
+ return_dict=True) # chat mode
56
+ inputs = inputs.to(device)
57
+ model = AutoModelForCausalLM.from_pretrained(
58
+ "THUDM/glm-4v-9b",
59
+ torch_dtype=torch.bfloat16,
60
+ low_cpu_mem_usage=True,
61
+ trust_remote_code=True
62
+ ).to(device).eval()
63
+ gen_kwargs = {"max_length": 2500, "do_sample": True, "top_k": 1}
64
+ with torch.no_grad():
65
+ outputs = model.generate(**inputs, **gen_kwargs)
66
+ outputs = outputs[:, inputs['input_ids'].shape[1]:]
67
+ print(tokenizer.decode(outputs[0]))
68
+ ```