char-fork/llama.cpp
git clone https://git.t4t.associates/char-fork/llama.cpp
01d8eaa28
char/aliceai-t5-moe
1#include "models.h" 2 3ggml_cgraph * clip_graph_nemotron_v2_vl::build () { 4GGML_ASSERT (model .class_embedding != nullptr ); 5GGML_ASSERT (model .position_embeddings != nullptr ); 6 7const int n_registers = model .class_embedding -> ne [1 ]; 8const int n_pos = n_patches + n_registers ; 9 10ggml_tensor * inp = build_inp (); 11 12// add position embeddings (pre-downsampled during GGUF conversion for fixed 512x512 input) 13inp = ggml_add (ctx0 ,inp ,model .position_embeddings ); 14cb (inp ,"inp_pos" ,-1 ); 15 16inp = ggml_concat (ctx0 ,model .class_embedding ,inp ,1 ); 17 18ggml_tensor * cur = build_vit (inp ,n_pos ,NORM_TYPE_NORMAL ,hparams .ffn_op ,nullptr ,nullptr ); 19 20cur = ggml_view_2d (ctx0 ,cur , 21n_embd ,n_patches , 22ggml_row_size (cur -> type ,n_embd ), 23n_registers * ggml_row_size (cur -> type ,n_embd )); 24 25cur = build_patch_merge_permute (cur ,model .hparams .n_merge ); 26 27 { 28cur = build_norm (cur ,model .mm_0_w ,nullptr ,NORM_TYPE_RMS ,1e-6 ,-1 ); 29cur = build_ffn (cur ,model .mm_1_w ,nullptr ,nullptr ,nullptr ,model .mm_3_w ,nullptr ,FFN_RELU_SQR ,-1 ); 30 } 31 32ggml_build_forward_expand (gf ,cur ); 33 34return gf ; 35}