Instructions to use trl-internal-testing/tiny-Glm5NextForConditionalGeneration with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use trl-internal-testing/tiny-Glm5NextForConditionalGeneration with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="trl-internal-testing/tiny-Glm5NextForConditionalGeneration") 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)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("trl-internal-testing/tiny-Glm5NextForConditionalGeneration") model = AutoModelForMultimodalLM.from_pretrained("trl-internal-testing/tiny-Glm5NextForConditionalGeneration", 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=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use trl-internal-testing/tiny-Glm5NextForConditionalGeneration with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "trl-internal-testing/tiny-Glm5NextForConditionalGeneration" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "trl-internal-testing/tiny-Glm5NextForConditionalGeneration", "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/trl-internal-testing/tiny-Glm5NextForConditionalGeneration
- SGLang
How to use trl-internal-testing/tiny-Glm5NextForConditionalGeneration 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 "trl-internal-testing/tiny-Glm5NextForConditionalGeneration" \ --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": "trl-internal-testing/tiny-Glm5NextForConditionalGeneration", "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 "trl-internal-testing/tiny-Glm5NextForConditionalGeneration" \ --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": "trl-internal-testing/tiny-Glm5NextForConditionalGeneration", "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 trl-internal-testing/tiny-Glm5NextForConditionalGeneration with Docker Model Runner:
docker model run hf.co/trl-internal-testing/tiny-Glm5NextForConditionalGeneration
Upload Glm5NextForConditionalGeneration
#3
by albertvillanova HF Staff - opened
- config.json +177 -4
- generation_config.json +1 -1
- model.safetensors +2 -2
config.json
CHANGED
|
@@ -7,11 +7,185 @@
|
|
| 7 |
"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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
"text_config": {
|
| 11 |
"attention_bias": false,
|
| 12 |
"attention_dropout": 0.0,
|
| 13 |
"bos_token_id": null,
|
| 14 |
-
"dtype": "bfloat16",
|
| 15 |
"eos_token_id": [
|
| 16 |
154820,
|
| 17 |
154827,
|
|
@@ -45,7 +219,7 @@
|
|
| 45 |
"linear_attention",
|
| 46 |
"linear_attention",
|
| 47 |
"linear_attention",
|
| 48 |
-
"
|
| 49 |
],
|
| 50 |
"linear_attn_config": {
|
| 51 |
"full_attn_layers": [
|
|
@@ -105,7 +279,7 @@
|
|
| 105 |
"vocab_size": 154880
|
| 106 |
},
|
| 107 |
"tie_word_embeddings": false,
|
| 108 |
-
"transformers_version": "5.
|
| 109 |
"video_end_token_id": 154833,
|
| 110 |
"video_start_token_id": 154832,
|
| 111 |
"video_token_id": 154855,
|
|
@@ -113,7 +287,6 @@
|
|
| 113 |
"attention_bias": true,
|
| 114 |
"attention_dropout": 0.0,
|
| 115 |
"depth": 2,
|
| 116 |
-
"dtype": "bfloat16",
|
| 117 |
"hidden_act": "silu",
|
| 118 |
"hidden_size": 16,
|
| 119 |
"image_size": 448,
|
|
|
|
| 7 |
"image_start_token_id": 154830,
|
| 8 |
"image_token_id": 154854,
|
| 9 |
"model_type": "glm5_next",
|
| 10 |
+
"quantization_config": {
|
| 11 |
+
"activation_scheme": "dynamic",
|
| 12 |
+
"fmt": "e4m3",
|
| 13 |
+
"modules_to_not_convert": [
|
| 14 |
+
"attn_mha",
|
| 15 |
+
"attn_mqa",
|
| 16 |
+
"dt_bias",
|
| 17 |
+
"hyper_connection",
|
| 18 |
+
"lm_head",
|
| 19 |
+
"mapping_proj",
|
| 20 |
+
"model.embed_tokens",
|
| 21 |
+
"model.layers.0.hc_attn_base",
|
| 22 |
+
"model.layers.0.hc_attn_fn",
|
| 23 |
+
"model.layers.0.hc_attn_scale",
|
| 24 |
+
"model.layers.0.hc_ffn_base",
|
| 25 |
+
"model.layers.0.hc_ffn_fn",
|
| 26 |
+
"model.layers.0.hc_ffn_scale",
|
| 27 |
+
"model.layers.0.input_layernorm",
|
| 28 |
+
"model.layers.0.post_attention_layernorm",
|
| 29 |
+
"model.layers.0.self_attn.A_log",
|
| 30 |
+
"model.layers.0.self_attn.b_proj",
|
| 31 |
+
"model.layers.0.self_attn.dt_bias",
|
| 32 |
+
"model.layers.0.self_attn.f_a_proj",
|
| 33 |
+
"model.layers.0.self_attn.f_b_proj",
|
| 34 |
+
"model.layers.0.self_attn.fused_qkvbfg_a_proj",
|
| 35 |
+
"model.layers.0.self_attn.g_a_proj",
|
| 36 |
+
"model.layers.0.self_attn.g_b_proj",
|
| 37 |
+
"model.layers.0.self_attn.k_conv1d",
|
| 38 |
+
"model.layers.0.self_attn.k_proj",
|
| 39 |
+
"model.layers.0.self_attn.o_norm",
|
| 40 |
+
"model.layers.0.self_attn.o_proj",
|
| 41 |
+
"model.layers.0.self_attn.q_conv1d",
|
| 42 |
+
"model.layers.0.self_attn.q_proj",
|
| 43 |
+
"model.layers.0.self_attn.qkv_proj",
|
| 44 |
+
"model.layers.0.self_attn.v_conv1d",
|
| 45 |
+
"model.layers.0.self_attn.v_proj",
|
| 46 |
+
"model.layers.1.hc_attn_base",
|
| 47 |
+
"model.layers.1.hc_attn_fn",
|
| 48 |
+
"model.layers.1.hc_attn_scale",
|
| 49 |
+
"model.layers.1.hc_ffn_base",
|
| 50 |
+
"model.layers.1.hc_ffn_fn",
|
| 51 |
+
"model.layers.1.hc_ffn_scale",
|
| 52 |
+
"model.layers.1.input_layernorm",
|
| 53 |
+
"model.layers.1.post_attention_layernorm",
|
| 54 |
+
"model.layers.1.self_attn.A_log",
|
| 55 |
+
"model.layers.1.self_attn.b_proj",
|
| 56 |
+
"model.layers.1.self_attn.dt_bias",
|
| 57 |
+
"model.layers.1.self_attn.f_a_proj",
|
| 58 |
+
"model.layers.1.self_attn.f_b_proj",
|
| 59 |
+
"model.layers.1.self_attn.fused_qkvbfg_a_proj",
|
| 60 |
+
"model.layers.1.self_attn.g_a_proj",
|
| 61 |
+
"model.layers.1.self_attn.g_b_proj",
|
| 62 |
+
"model.layers.1.self_attn.k_conv1d",
|
| 63 |
+
"model.layers.1.self_attn.k_proj",
|
| 64 |
+
"model.layers.1.self_attn.o_norm",
|
| 65 |
+
"model.layers.1.self_attn.o_proj",
|
| 66 |
+
"model.layers.1.self_attn.q_conv1d",
|
| 67 |
+
"model.layers.1.self_attn.q_proj",
|
| 68 |
+
"model.layers.1.self_attn.qkv_proj",
|
| 69 |
+
"model.layers.1.self_attn.v_conv1d",
|
| 70 |
+
"model.layers.1.self_attn.v_proj",
|
| 71 |
+
"model.layers.2.hc_attn_base",
|
| 72 |
+
"model.layers.2.hc_attn_fn",
|
| 73 |
+
"model.layers.2.hc_attn_scale",
|
| 74 |
+
"model.layers.2.hc_ffn_base",
|
| 75 |
+
"model.layers.2.hc_ffn_fn",
|
| 76 |
+
"model.layers.2.hc_ffn_scale",
|
| 77 |
+
"model.layers.2.input_layernorm",
|
| 78 |
+
"model.layers.2.post_attention_layernorm",
|
| 79 |
+
"model.layers.2.self_attn.A_log",
|
| 80 |
+
"model.layers.2.self_attn.b_proj",
|
| 81 |
+
"model.layers.2.self_attn.dt_bias",
|
| 82 |
+
"model.layers.2.self_attn.f_a_proj",
|
| 83 |
+
"model.layers.2.self_attn.f_b_proj",
|
| 84 |
+
"model.layers.2.self_attn.fused_qkvbfg_a_proj",
|
| 85 |
+
"model.layers.2.self_attn.g_a_proj",
|
| 86 |
+
"model.layers.2.self_attn.g_b_proj",
|
| 87 |
+
"model.layers.2.self_attn.k_conv1d",
|
| 88 |
+
"model.layers.2.self_attn.k_proj",
|
| 89 |
+
"model.layers.2.self_attn.o_norm",
|
| 90 |
+
"model.layers.2.self_attn.o_proj",
|
| 91 |
+
"model.layers.2.self_attn.q_conv1d",
|
| 92 |
+
"model.layers.2.self_attn.q_proj",
|
| 93 |
+
"model.layers.2.self_attn.qkv_proj",
|
| 94 |
+
"model.layers.2.self_attn.v_conv1d",
|
| 95 |
+
"model.layers.2.self_attn.v_proj",
|
| 96 |
+
"model.layers.3.hc_attn_base",
|
| 97 |
+
"model.layers.3.hc_attn_fn",
|
| 98 |
+
"model.layers.3.hc_attn_scale",
|
| 99 |
+
"model.layers.3.hc_ffn_base",
|
| 100 |
+
"model.layers.3.hc_ffn_fn",
|
| 101 |
+
"model.layers.3.hc_ffn_scale",
|
| 102 |
+
"model.layers.3.input_layernorm",
|
| 103 |
+
"model.layers.3.mlp.gate",
|
| 104 |
+
"model.layers.3.mlp.gate.e_score_correction_bias",
|
| 105 |
+
"model.layers.3.post_attention_layernorm",
|
| 106 |
+
"model.layers.3.self_attn.indexer.index_kpool_compress_ape",
|
| 107 |
+
"model.layers.3.self_attn.indexer.index_kpool_compress_gate",
|
| 108 |
+
"model.layers.3.self_attn.indexer.k_norm",
|
| 109 |
+
"model.layers.3.self_attn.indexer.k_norm.bias",
|
| 110 |
+
"model.layers.3.self_attn.indexer.weights_proj",
|
| 111 |
+
"model.layers.3.self_attn.indexer.wk",
|
| 112 |
+
"model.layers.3.self_attn.indexer.wq_b",
|
| 113 |
+
"model.layers.3.self_attn.kv_a_layernorm",
|
| 114 |
+
"model.layers.3.self_attn.kv_b_proj",
|
| 115 |
+
"model.layers.3.self_attn.q_a_layernorm",
|
| 116 |
+
"model.layers.4.eh_proj",
|
| 117 |
+
"model.layers.4.enorm",
|
| 118 |
+
"model.layers.4.hnorm",
|
| 119 |
+
"model.layers.4.input_layernorm",
|
| 120 |
+
"model.layers.4.mlp.gate",
|
| 121 |
+
"model.layers.4.mlp.gate.e_score_correction_bias",
|
| 122 |
+
"model.layers.4.post_attention_layernorm",
|
| 123 |
+
"model.layers.4.self_attn.indexer.index_kpool_compress_ape",
|
| 124 |
+
"model.layers.4.self_attn.indexer.index_kpool_compress_gate",
|
| 125 |
+
"model.layers.4.self_attn.indexer.k_norm",
|
| 126 |
+
"model.layers.4.self_attn.indexer.k_norm.bias",
|
| 127 |
+
"model.layers.4.self_attn.indexer.weights_proj",
|
| 128 |
+
"model.layers.4.self_attn.indexer.wk",
|
| 129 |
+
"model.layers.4.self_attn.indexer.wq_b",
|
| 130 |
+
"model.layers.4.self_attn.kv_a_layernorm",
|
| 131 |
+
"model.layers.4.self_attn.kv_b_proj",
|
| 132 |
+
"model.layers.4.self_attn.q_a_layernorm",
|
| 133 |
+
"model.layers.4.shared_head.norm",
|
| 134 |
+
"model.norm",
|
| 135 |
+
"model.visual",
|
| 136 |
+
"router",
|
| 137 |
+
"visual",
|
| 138 |
+
"visual.blocks.0.attn.k_norm",
|
| 139 |
+
"visual.blocks.0.attn.proj",
|
| 140 |
+
"visual.blocks.0.attn.proj.bias",
|
| 141 |
+
"visual.blocks.0.attn.q_norm",
|
| 142 |
+
"visual.blocks.0.attn.qkv",
|
| 143 |
+
"visual.blocks.0.attn.qkv.bias",
|
| 144 |
+
"visual.blocks.0.mlp.down_proj",
|
| 145 |
+
"visual.blocks.0.mlp.down_proj.bias",
|
| 146 |
+
"visual.blocks.0.mlp.gate_proj",
|
| 147 |
+
"visual.blocks.0.mlp.gate_proj.bias",
|
| 148 |
+
"visual.blocks.0.mlp.up_proj",
|
| 149 |
+
"visual.blocks.0.mlp.up_proj.bias",
|
| 150 |
+
"visual.blocks.0.norm1",
|
| 151 |
+
"visual.blocks.0.norm2",
|
| 152 |
+
"visual.blocks.1.attn.k_norm",
|
| 153 |
+
"visual.blocks.1.attn.proj",
|
| 154 |
+
"visual.blocks.1.attn.proj.bias",
|
| 155 |
+
"visual.blocks.1.attn.q_norm",
|
| 156 |
+
"visual.blocks.1.attn.qkv",
|
| 157 |
+
"visual.blocks.1.attn.qkv.bias",
|
| 158 |
+
"visual.blocks.1.mlp.down_proj",
|
| 159 |
+
"visual.blocks.1.mlp.down_proj.bias",
|
| 160 |
+
"visual.blocks.1.mlp.gate_proj",
|
| 161 |
+
"visual.blocks.1.mlp.gate_proj.bias",
|
| 162 |
+
"visual.blocks.1.mlp.up_proj",
|
| 163 |
+
"visual.blocks.1.mlp.up_proj.bias",
|
| 164 |
+
"visual.blocks.1.norm1",
|
| 165 |
+
"visual.blocks.1.norm2",
|
| 166 |
+
"visual.downsample",
|
| 167 |
+
"visual.downsample.bias",
|
| 168 |
+
"visual.merger.down_proj",
|
| 169 |
+
"visual.merger.gate_proj",
|
| 170 |
+
"visual.merger.post_projection_norm",
|
| 171 |
+
"visual.merger.post_projection_norm.bias",
|
| 172 |
+
"visual.merger.proj",
|
| 173 |
+
"visual.merger.up_proj",
|
| 174 |
+
"visual.patch_embed.proj",
|
| 175 |
+
"visual.patch_embed.proj.bias",
|
| 176 |
+
"visual.post_layernorm",
|
| 177 |
+
"weights_proj"
|
| 178 |
+
],
|
| 179 |
+
"quant_method": "fp8",
|
| 180 |
+
"weight_block_size": [
|
| 181 |
+
32,
|
| 182 |
+
32
|
| 183 |
+
]
|
| 184 |
+
},
|
| 185 |
"text_config": {
|
| 186 |
"attention_bias": false,
|
| 187 |
"attention_dropout": 0.0,
|
| 188 |
"bos_token_id": null,
|
|
|
|
| 189 |
"eos_token_id": [
|
| 190 |
154820,
|
| 191 |
154827,
|
|
|
|
| 219 |
"linear_attention",
|
| 220 |
"linear_attention",
|
| 221 |
"linear_attention",
|
| 222 |
+
"indexed_attention"
|
| 223 |
],
|
| 224 |
"linear_attn_config": {
|
| 225 |
"full_attn_layers": [
|
|
|
|
| 279 |
"vocab_size": 154880
|
| 280 |
},
|
| 281 |
"tie_word_embeddings": false,
|
| 282 |
+
"transformers_version": "5.23.0",
|
| 283 |
"video_end_token_id": 154833,
|
| 284 |
"video_start_token_id": 154832,
|
| 285 |
"video_token_id": 154855,
|
|
|
|
| 287 |
"attention_bias": true,
|
| 288 |
"attention_dropout": 0.0,
|
| 289 |
"depth": 2,
|
|
|
|
| 290 |
"hidden_act": "silu",
|
| 291 |
"hidden_size": 16,
|
| 292 |
"image_size": 448,
|
generation_config.json
CHANGED
|
@@ -7,5 +7,5 @@
|
|
| 7 |
],
|
| 8 |
"pad_token_id": 154820,
|
| 9 |
"temperature": 1.0,
|
| 10 |
-
"transformers_version": "5.
|
| 11 |
}
|
|
|
|
| 7 |
],
|
| 8 |
"pad_token_id": 154820,
|
| 9 |
"temperature": 1.0,
|
| 10 |
+
"transformers_version": "5.23.0"
|
| 11 |
}
|
model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:87f1f1bdd919166e3737201dbaf3896f23882957f8782bb5a1c4184f344e0c86
|
| 3 |
+
size 20042732
|